Recipes← all recipesView on GitHub

Inject a message into a live AI call

AI Agentslive AI agent prompt updates

Send a REST command to update a live AI call with a system message, shared data, or a replacement prompt.

observability

The claim

POST /api/calling/calls with command: calling.ai_message addresses a call that is running an AI agent, by id. The body carries the call id at the top level and a params object. The vendored REST spec, tools/openapi/rest.json, describes the system role as injecting “instructions or context that modify the AI’s behavior mid-conversation without the caller hearing it”. The same params take global_data, “arbitrary JSON data to merge into the AI session’s global data store”, or reset, with full_reset and a new system_prompt.

Why it holds

The verifier proves the request. The spec is the authority for what the platform does with it.

How it works

client = RestClient()

def nudge(call_id, instruction):
    return client.calling.ai_message(call_id, role="system", message_text=instruction)

def share(call_id, data):
    return client.calling.ai_message(call_id, global_data=data)

def restart(call_id, system_prompt):
    return client.calling.ai_message(
        call_id, reset={"full_reset": True, "system_prompt": system_prompt})

What the platform receives for nudge:

{"command": "calling.ai_message",
 "id": "6d3f4a0e-2b1c-4e7a-9f0d-1c2b3a4d5e6f",
 "params": {"role": "system",
            "message_text": "The caller is a returning customer. Skip the identity questions."}}

The SDK’s calling namespace, rest/namespaces/calling.py, sends every call command to that one path. It puts the call id in id. The spec marks command, id and params required for this command. Its role enum is system, user or assistant. The spec describes user as “a message as if the caller said it” and assistant as “a message as if the AI said it”.

Your backend learns the call id from the agent. The tool webhook body carries it as call_id; see the SWAIG tool webhook.

Limitations

The verifier proves the request, not the model’s reaction. What the next turn does with a system message is the model’s behaviour on a live call.

The spec describes a user role message as one the AI treats “as if the caller said it”. Keep it out of flows where the caller’s words matter as a record.

What to change first

Change role="system" to role="operator" in nudge and run the verifier. The role assertion fails, which is the point: the three roles are the whole vocabulary.