Skip to main content
Lesson 14 of 16 · Voice Agent API: real-time conversations

Built-in tools: web search, X, and collections

Lesson 14 of 16 Updated July 30, 2026 Developer
On this page
  1. The Voice Agent’s native tools
  2. web_search: search the web
  3. x_search: search X (Twitter)
  4. file_search: search RAG collections
  5. Combine several tools
  6. Key takeaways

The Voice Agent’s native tools

Besides custom function calling and MCP servers, the Voice Agent API provides several built-in tools the agent can use on its own during the conversation. These tools need no execution logic on your side: xAI’s servers handle them entirely.

web_search: search the web

This tool lets the agent look up information on the web in real time during the conversation:

{
  "type": "session.update",
  "session": {
    "tools": [
      {"type": "web_search"}
    ]
  }
}

When the user asks a factual question (“What’s the weather in Paris?”, “Who won the game last night?”), the agent runs a web search automatically and uses the results to put together its spoken answer.

No specific event is sent to the client for built-in tools: the agent uses the results internally and works them into its audio response.

x_search: search X (Twitter)

This tool lets the agent search posts on the X platform:

{
  "type": "session.update",
  "session": {
    "tools": [
      {
        "type": "x_search",
        "allowed_x_handles": ["xai", "gaborcselle"]
      }
    ]
  }
}

The allowed_x_handles parameter is optional. When it’s set, the search is limited to posts from those specific accounts. Without it, the agent searches all of X.

x_search use cases

  • Competitive monitoring: “What did [competitor] post this week?”
  • Customer support: “Are there any recent complaints about our product on X?”
  • News: “What’s the latest on [topic]?”
  • Trends: “What are people talking about right now in [industry]?“

file_search: search RAG collections

The file_search tool lets the voice agent query collections of vectorized documents (RAG). It’s the ideal tool for agents that need access to an internal knowledge base:

{
  "type": "session.update",
  "session": {
    "tools": [
      {
        "type": "file_search",
        "vector_store_ids": ["vs_abc123", "vs_def456"],
        "max_num_results": 10
      }
    ]
  }
}

Parameters

  • vector_store_ids: the IDs of the vector collections to query. You can list several to combine different knowledge sources
  • max_num_results: the maximum number of results to return (10 by default)

Usage scenarios

  • Voice FAQ: the agent answers customer questions based on your documentation
  • Technical support: searching manuals and troubleshooting guides
  • Training: the agent has access to course content to answer learners’ questions
  • Legal assistance: searching contracts and legal documents

Combine several tools

You can enable several tools at once. The agent picks the most relevant one based on the context of the conversation:

{
  "type": "session.update",
  "session": {
    "tools": [
      {"type": "web_search"},
      {"type": "x_search"},
      {
        "type": "file_search",
        "vector_store_ids": ["vs_documentation"]
      },
      {
        "type": "function",
        "name": "create_ticket",
        "description": "Creates a support ticket",
        "parameters": {
          "type": "object",
          "properties": {
            "subject": {"type": "string"},
            "priority": {"type": "string", "enum": ["low", "medium", "high"]}
          },
          "required": ["subject"]
        }
      },
      {
        "type": "mcp",
        "server_url": "https://mcp.exemple.com/sse",
        "server_label": "CRM"
      }
    ]
  }
}

In this example, the agent can:

  • Search the web for general questions
  • Check X for trends and opinions
  • Dig into internal documentation for technical questions
  • Create a ticket through function calling
  • Access the CRM through MCP

Key takeaways

  • Five types of tools are available: web_search, x_search, file_search, function, and mcp
  • Built-in tools (web_search, x_search, file_search) run on the server with no code on your part
  • file_search queries vector collections for RAG
  • x_search can be limited to specific accounts with allowed_x_handles
  • You can combine every type of tool in the same session