Web Search
Search the internet in real-time with AI-powered search
The web_search
tool enables Letta agents to search the internet for current information, research, and general knowledge using Exa’s AI-powered search engine.
On Letta Cloud, this tool works out of the box. For self-hosted deployments, you’ll need to configure an Exa API key.
Quick Start
Adding Web Search to an Agent
Usage Example
Your agent can now choose to use web_search
when it needs current information.
Self-Hosted Setup
For self-hosted Letta servers, you’ll need an Exa API key.
Get an API Key
- Sign up at dashboard.exa.ai
- Copy your API key
- See Exa pricing for rate limits and costs
Configuration Options
Tool Parameters
The web_search
tool supports advanced filtering and search customization:
Available Categories
Use the category
parameter to focus your search on specific content types:
Return Format
The tool returns a JSON-encoded string containing:
Best Practices
1. Guide When to Search
Provide clear instructions to your agent about when web search is appropriate:
2. Combine with Archival Memory
Use web search for external/current information, and archival memory for your organization’s internal data:
See the Archival Memory documentation for more information.
3. Craft Effective Search Queries
Exa uses neural search that understands semantic meaning. Your agent will generally form good queries naturally, but you can improve results by guiding it to:
- Be descriptive and specific: “Latest research on RLHF techniques for language models” is better than “RLHF research”
- Focus on topics, not keywords: “How companies are deploying AI agents in customer service” works better than “AI agents customer service deployment”
- Use natural language: The search engine understands conversational queries like “What are the environmental impacts of Bitcoin mining?”
- Specify time ranges when relevant: Guide your agent to use date filters for time-sensitive queries
Example instruction in memory:
4. Manage Context Window
By default, include_text
is False
to avoid context overflow. The tool returns highlights and AI-generated summaries instead, which are more concise:
Common Patterns
Research Assistant
News Monitor
Customer Support
Troubleshooting
Agent Not Using Web Search
Check:
- Tool is attached:
"web_search"
in agent’s tools list - Instructions are clear about when to search
- Model has good tool-calling capabilities (GPT-4, Claude 3+)
Missing EXA_API_KEY
If you see errors about missing API keys on self-hosted deployments: