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

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="interrupt_and_restart", description="Interrupt and restart the conversation")
def interrupt_and_restart(args, raw_data):
return (
FunctionResult()
.stop()
.say("Let me start over.")
)
agent.serve()