***

title: rpc_ai_message
slug: /reference/python/agents/function-result/rpc-ai-message
description: Inject a message into the AI agent running on another call.
max-toc-depth: 3
---------------------

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

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

Inject a message into the AI agent running on another call. Useful for
cross-call coordination, such as notifying a held caller's agent about a
status change or instructing it to relay information.

## **Parameters**

<ParamField path="call_id" type="str" required={true} toc={true}>
  Call ID of the target call whose AI agent should receive the message.
</ParamField>

<ParamField path="message_text" type="str" required={true} toc={true}>
  The message text to inject into the target AI's conversation.
</ParamField>

<ParamField path="role" type="str" default="system" toc={true}>
  Role for the injected message. Typically `"system"` for instructions.
</ParamField>

## **Returns**

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

## **Example**

```python {12}
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="notify_caller", description="Notify the caller on the other line")
def notify_caller(args, raw_data):
    caller_call_id = args.get("original_call_id")
    return (
        FunctionResult("I'll let them know.")
        .rpc_ai_message(
            call_id=caller_call_id,
            message_text="The person you're trying to reach is unavailable. Please leave a message."
        )
    )

agent.serve()
```