AgentsAgentBase

set_native_functions

View as MarkdownOpen in Claude

Set the list of native SWAIG functions to enable. Native functions are built into the SignalWire platform and execute server-side without requiring a webhook. They provide common utility operations that the AI can invoke during a conversation.

Native functions can also be passed at construction time via the native_functions constructor parameter.

Parameters

function_names
list[str]Required

List of native function names to enable. Common native functions include:

  • "check_time" — Get the current time in a given timezone
  • "wait_for_user" — Pause the AI and wait for the caller to speak
  • "next_step" — Advance to the next step in a context workflow
  • "transfer" — Transfer the call to another number or agent

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="assistant", route="/assistant")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.set_native_functions(["check_time", "wait_for_user"])
6agent.serve()

Or set at construction time:

1from signalwire import AgentBase
2
3agent = AgentBase(
4 name="assistant",
5 route="/assistant",
6 native_functions=["check_time", "wait_for_user"]
7)
8agent.set_prompt_text("You are a helpful assistant.")
9agent.serve()