RelayActions

AIAction

View as MarkdownOpen in Claude

Returned from call.ai(). Tracks an active AI agent session on the call. Terminal states: finished, error.

AI sessions typically end when the call ends or when explicitly stopped. The terminal event may not carry a standard state field like other actions.

Inherits all properties and methods from the base Action interface (control_id, is_done, completed, result, wait()).

Properties

No additional properties beyond the base Action interface.

Methods

Example

from signalwire.relay import RelayClient
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
await call.answer()
action = await call.ai(
prompt={"text": "You are a helpful assistant."},
ai_params={"temperature": 0.7},
)
# Wait for it to complete naturally
event = await action.wait()
client.run()