stop

View as MarkdownOpen in Claude

Stop the agent execution immediately. This halts the AI from processing further and can be used to interrupt the current speech flow.

Parameters

None.

Returns

FunctionResult — self, for chaining.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="interrupt_and_restart", description="Interrupt and restart the conversation")
8def interrupt_and_restart(args, raw_data):
9 return (
10 FunctionResult()
11 .stop()
12 .say("Let me start over.")
13 )
14
15agent.serve()