Web
Search and fetch content from the web.
Search and fetch content from the web. The provider exposes one tool: query_web. You choose the backend (Exa, Parallel, or MCP).
In a virtual environment, install the direct Exa backend and model SDK:
uv pip install -U "agno[exa]" openai
export OPENAI_API_KEY="your-openai-api-key"
export EXA_API_KEY="your-exa-api-key"Save as web_context.py and run python web_context.py:
import asyncio
from agno.agent import Agent
from agno.context.web import WebContextProvider, ExaBackend
from agno.models.openai import OpenAIResponses
async def main():
web = WebContextProvider(
backend=ExaBackend(), model=OpenAIResponses(id="gpt-5.4-mini")
)
try:
await web.asetup()
agent = Agent(
model=OpenAIResponses(id="gpt-5.4"),
tools=web.get_tools(),
instructions=web.instructions(),
)
await agent.aprint_response("What are the latest developments in AI agents?")
finally:
await web.aclose()
if __name__ == "__main__":
asyncio.run(main())WebContextProvider is read-only. There is no update_web tool.
Installation
Install the optional dependency for the selected backend. The example’s main and sub-agent models also require openai and OPENAI_API_KEY. Backend configuration fragments below replace web inside the same async runner.
| Backend | Install command |
|---|---|
ExaBackend | uv pip install "agno[exa]" |
ParallelBackend | uv pip install "agno[parallel]" |
ExaMCPBackend or ParallelMCPBackend | uv pip install "agno[mcp]" |
Backends
Search and fetch through Exa’s SDK.
from agno.context.web import WebContextProvider, ExaBackend
web = WebContextProvider(backend=ExaBackend())Requires EXA_API_KEY environment variable.
Exa via MCP protocol.
from agno.context.web import WebContextProvider, ExaMCPBackend
web = WebContextProvider(backend=ExaMCPBackend())Requires lifecycle setup with await web.asetup().
Web search and extraction via Parallel's API.
from agno.context.web import WebContextProvider, ParallelBackend
web = WebContextProvider(backend=ParallelBackend())Requires PARALLEL_API_KEY environment variable.
Parallel via MCP protocol.
from agno.context.web import WebContextProvider, ParallelMCPBackend
web = WebContextProvider(backend=ParallelMCPBackend())Requires lifecycle setup with await web.asetup().
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
backend | ContextBackend | required | Search backend (ExaBackend, ExaMCPBackend, ParallelBackend, ParallelMCPBackend). |
id | str | "web" | Tool becomes query_<id>. |
model | Model | None | Model for the sub-agent. |
mode | ContextMode | default | See Mode. |
Tools Exposed
| Tool | Description |
|---|---|
query_web | Search the web, fetch pages, synthesize answers with citations. |
Lifecycle
MCP backends (ExaMCPBackend, ParallelMCPBackend) require setup and teardown for the server connection. Reuse the complete runner above with your selected backend. Direct SDK backends have no persistent MCP session; their lifecycle methods are no-ops.
MCP setup is best-effort and logs connection failures. These web backends’ status() and astatus() describe configuration, not live connectivity, so ok=True is not proof of a successful connection. Handle failed tool calls and keep aclose() in finally. The optional EXA_API_KEY/PARALLEL_API_KEY and each MCP backend’s configuration determine its authenticated endpoint and provider limits.
Example queries
| Query | What happens |
|---|---|
| "What is the current state of WebGPU support?" | Searches, fetches recent articles, synthesizes |
| "Find documentation on Python 3.12 new features" | Searches docs, returns summary with links |
| "Research competitors to Stripe Atlas" | Multi-source search and synthesis |