Skip to main content

Web Search

Search the web and retrieve ranked results

Try it with Celesto AI SDK

This snippet uses your Celesto API key in the Authorization header.

import asyncio

from agentor import Agentor
from agentor.mcp import MCPServerStreamableHttp

mcp_url = "https://api.celesto.ai/v1/mcp-servers/web_search"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
}


async def main() -> None:
    async with MCPServerStreamableHttp(
        name="Streamable HTTP Python Server",
        params={
            "url": mcp_url,
            "timeout": 10,
            "headers": headers,
        },
        cache_tools_list=True,
        max_retry_attempts=3,
    ) as server:
        agent = Agentor(
            name="Assistant",
            instructions="You are a helpful assistant with access to the Web Search tool.",
            tools=[server],
        )
        result = await agent.arun("How is the weather in London?")
        print(result.final_output)


asyncio.run(main())