AgentsAgentBase

set_web_hook_url

View as MarkdownOpen in Claude

Override the default webhook URL used for SWAIG function calls in the generated SWML document. By default, the SDK computes this URL from the agent’s host, port, and route. Use this method when your agent is behind a reverse proxy, load balancer, or tunnel (e.g., ngrok) and the auto-detected URL does not match the external address.

You can also set the SWML_PROXY_URL_BASE environment variable to override the base URL globally without calling this method.

Parameters

url
strRequired

The full URL that SignalWire should use to reach this agent’s SWAIG endpoints.

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("You are a helpful assistant.")
5# Agent is behind ngrok
6agent.set_web_hook_url("https://abc123.ngrok.io/support")
7agent.serve()