rpc_ai_global_data

View as MarkdownOpen in Claude

Merge data into another call’s global_data without injecting a conversation turn. A thin wrapper over rpc_ai_message() with only global_data set. Use it when the other call needs a value rather than an instruction; the destination prompt reads it back with ${global_data.key}.

Parameters

call_id
strRequired

Call ID of the target call.

data
dict[str, Any]Required

Object merged into that call’s global_data. Existing keys not in data are left in place.

Returns

FunctionResult — self, for chaining.

Example

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="share_eta", description="Send the ETA to the waiting caller")
def share_eta(args, raw_data):
waiting_call_id = args["waiting_call_id"]
return (
FunctionResult("Tell the driver the passenger has been updated.")
.rpc_ai_global_data(waiting_call_id, {"eta_minutes": args["eta_minutes"]})
.rpc_ai_unhold(waiting_call_id)
)
agent.serve()