Skip to main content

Calculator

Evaluate arithmetic and mathematical expressions

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/calculator"
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 Calculator tool.",
            tools=[server],
        )
        result = await agent.arun("How is the weather in London?")
        print(result.final_output)


asyncio.run(main())