Native Functions
Native Functions
Native functions are built-in SignalWire capabilities that can be enabled without writing code. They provide common operations like web search and debugging.
What Are Native Functions?
Native functions run directly on SignalWire’s platform. Enable them to give the AI access to built-in capabilities without creating handlers.
Available Native Functions:
web_search- Search the webdebug- Debug mode for testing
Enabling Native Functions
Enable native functions in the constructor:
Web Search Function
Enable web search to let the AI autonomously search the web during conversations:
How Web Search Works
When enabled, the AI can decide to search the web when it needs information to answer a question. The process is:
- AI decides to search: Based on the conversation, the AI determines a search is needed
- Query formulation: The AI creates a search query from the conversation context
- Search execution: SignalWire executes the search on the AI’s behalf
- Results processing: Search results are returned to the AI as context
- Response generation: The AI synthesizes the results into a spoken response
The caller doesn’t interact with search directly—the AI handles everything automatically.
What Web Search Returns
The AI receives search results including:
- Page titles and snippets
- URLs of matching pages
- Relevant text excerpts
The AI then summarizes and presents this information conversationally. It doesn’t read URLs or raw HTML to the caller.
Web Search Limitations
No control over search behavior:
- Cannot specify search engine (Google, Bing, etc.)
- Cannot filter by domain or site
- Cannot control result count
- Cannot exclude specific sources
Content limitations:
- Results may be outdated (search index lag)
- Cannot access paywalled or login-required content
- Cannot search private/internal sites
- May not find very recent information
No result logging:
- Search queries aren’t logged to your server
- Cannot audit what was searched
- Cannot cache results for reuse
Rate and cost:
- Subject to SignalWire’s rate limits
- May incur additional usage costs
- Multiple searches per call add latency
When to Use Native web_search
Good use cases:
- General knowledge questions (“What year was the Eiffel Tower built?”)
- Current events (with freshness caveats)
- Quick fact lookups during calls
- Agents that need broad knowledge access
When to use alternatives instead:
Prompting for Web Search
Guide the AI on when and how to use web search:
Debug Function
Enable debug mode for development and testing:
What Debug Provides
The debug function exposes diagnostic information during calls:
- Current conversation state
- Function call history
- Configuration details
- Timing information
When to Use Debug
Use during development:
- Testing conversation flows
- Verifying function registration
- Checking prompt configuration
- Troubleshooting unexpected behavior
Don’t use in production:
- Exposes internal details to callers
- May reveal sensitive configuration
- Adds unnecessary function to AI’s options
- Remove before deploying to production
Call Transfers
For call transfers, use SwaigFunctionResult.connect() in a custom handler function - there is no native transfer function:
Combining Native and Custom Functions
Use native functions alongside your custom handlers:
When to Use Native vs Custom Functions
Native Functions Reference
Next Steps
You’ve now learned all about SWAIG functions. Next, explore Skills to add pre-built capabilities to your agents.