***

title: execute_rpc
slug: /reference/python/agents/function-result/execute-rpc
description: Execute a generic RPC method on a call.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[rpc-dial]: /docs/server-sdks/reference/python/agents/function-result/rpc-dial

[rpc-ai-message]: /docs/server-sdks/reference/python/agents/function-result/rpc-ai-message

[rpc-ai-unhold]: /docs/server-sdks/reference/python/agents/function-result/rpc-ai-unhold

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Execute a generic RPC method on a call. This is the low-level interface for
cross-call communication. For common operations, prefer the specific helpers
[`rpc_dial()`][rpc-dial],
[`rpc_ai_message()`][rpc-ai-message], and
[`rpc_ai_unhold()`][rpc-ai-unhold].

## **Parameters**

<ParamField path="method" type="str" required={true} toc={true}>
  RPC method name (e.g., `"dial"`, `"ai_message"`, `"ai_unhold"`).
</ParamField>

<ParamField path="params" type="Optional[dict[str, Any]]" default="None" toc={true}>
  Parameters for the RPC method.
</ParamField>

<ParamField path="call_id" type="Optional[str]" default="None" toc={true}>
  Target call ID for the RPC command.
</ParamField>

<ParamField path="node_id" type="Optional[str]" default="None" toc={true}>
  Target node ID for the RPC command.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Example**

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="execute_custom_rpc", description="Execute a custom RPC command")
def execute_custom_rpc(args, raw_data):
    return (
        FunctionResult("Executing RPC.")
        .execute_rpc(
            method="ai_message",
            call_id="target-call-id",
            params={"role": "system", "message_text": "Hello from another call."}
        )
    )

agent.serve()
```