Skip to navigation

agent_says

View as MarkdownOpen in Claude

The agent says text, as the model’s reply. It’s added to the call log as an assistant turn. When an earlier result was post_process, its actions run now, after the reply, as the platform runs them. A test that checks a post_process hangup or step change calls agent_says() first.

Parameters

text
strRequired

The model’s reply.

Returns

CallSimulator — Self, for chaining.

Example

from signalwire import AgentBase, FunctionResult
from signalwire.testing import CallSimulator
agent = AgentBase(name="frontdesk", route="/frontdesk")
agent.prompt_add_section("Role", "You answer the front desk.")
agent.define_tool("finish", "End the call after saying goodbye", {"type": "object", "properties": {}},
lambda args, raw_data: FunctionResult("Say goodbye.", post_process=True).hangup())
sim = CallSimulator(agent)
sim.call("finish")
print(sim.ended)
# False
sim.agent_says("Thanks for calling. Goodbye!")
print(sim.ended)
# True