from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.anthropic import Claude
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.tools.mcp import MCPTools
Create the Agent
agno_agent = Agent(
name=“Agno Agent”,
model=OpenAIChat(id=“gpt-4o-mini”),
Add a database to the Agent
db=SqliteDb(db_file=“agno.db”),
Add the Agno MCP server to the Agent
tools=[MCPTools(transport=“streamable-http”, url=“Page Not Found)],
Add the previous session history to the context
add_history_to_context=True,
markdown=True,
)
agent_os = AgentOS(agents=[agno_agent])
app = agent_os.get_app()
Following the tutorial but not able to chat with the first agent. Getting below error.
INFO 127.0.0.1:60042 - “GET /sessions/012d47d3-8c6e-415f-a52a-92d58f1a6caa?type=agent&user_id=80f180af-f75c-4e7c-a139-fbacc867977c&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1” 404
INFO 127.0.0.1:60042 - “GET /sessions/012d47d3-8c6e-415f-a52a-92d58f1a6caa/runs?session_id=012d47d3-8c6e-415f-a52a-92d58f1a6caa&type=agent&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1” 200
INFO 127.0.0.1:60343 - “GET /sessions?page=1&type=agent&limit=20&sort_by=updated_at&sort_order=desc&user_id=garg10may%40gmail.com&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1” 200
INFO 127.0.0.1:60344 - “GET /sessions/012d47d3-8c6e-415f-a52a-92d58f1a6caa/runs?session_id=012d47d3-8c6e-415f-a52a-92d58f1a6caa&type=agent&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1” 200
INFO 127.0.0.1:60360 - “GET /health HTTP/1.1” 200
ERROR WebSocket error: (1000, ‘Intentional disconnect’)
INFO connection closed
INFO 127.0.0.1:60362 - “WebSocket /workflows/ws”
INFO connection open
INFO 127.0.0.1:60360 - “GET /agents HTTP/1.1” 200
INFO 127.0.0.1:60364 - “GET /teams HTTP/1.1” 200
INFO 127.0.0.1:60367 - “GET /workflows HTTP/1.1” 200
INFO 127.0.0.1:60368 - “GET /config HTTP/1.1” 200
INFO 127.0.0.1:60421 - “POST /agents/agno-agent/runs HTTP/1.1” 200
ERROR Traceback (most recent call last):
File “/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/starlette/routing.py”, line 701, in lifespan
await receive()
File “/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/uvicorn/lifespan/on.py”, line 137, in receive
return await self.receive_queue.get()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/garg10may/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/asyncio/queues.py”, line 158, in get
await getter
asyncio.exceptions.CancelledError: Cancelled via cancel scope 113fdb890
ERROR Failed to call MCP tool ‘SearchAgno’: Timed out while waiting for response to ClientRequest. Waited 10.0 seconds.
Traceback (most recent call last):
File “/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/streams/memory.py”, line 111, in receive
return self.receive_nowait()
^^^^^^^^^^^^^^^^^^^^^
File “/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/streams/memory.py”, line 106, in receive_nowait
raise WouldBlock
anyio.WouldBlock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/_core/_tasks.py", line 120, in fail_after
yield cancel_scope
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 272, in send_request
response_or_error = await response_stream_reader.receive()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 119, in receive
await receive_event.wait()
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1783, in wait
await self._event.wait()
File "/Users/garg10may/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled via cancel scope 115d57b00; reason: deadline exceeded
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 271, in send_request
with anyio.fail_after(timeout):
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/garg10may/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/anyio/_core/_tasks.py", line 123, in fail_after
raise TimeoutError
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/agno/utils/mcp.py", line 35, in call_tool
result: CallToolResult = await session.call_tool(tool_name, kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/mcp/client/session.py", line 279, in call_tool
result = await self.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/garg10may/coding/agno/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 274, in send_request
raise McpError(
mcp.shared.exceptions.McpError: Timed out while waiting for response to ClientRequest. Waited 10.0 seconds.
INFO 127.0.0.1:60528 - "OPTIONS /sessions/b2e092df-3af7-4fc1-9b40-8f699ae1c976?type=agent&user_id=80f180af-f75c-4e7c-a139-fbacc867977c&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1" 200
INFO 127.0.0.1:60530 - "GET /sessions/b2e092df-3af7-4fc1-9b40-8f699ae1c976?type=agent&user_id=80f180af-f75c-4e7c-a139-fbacc867977c&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1" 404
INFO 127.0.0.1:60421 - "OPTIONS /sessions/b2e092df-3af7-4fc1-9b40-8f699ae1c976/runs?session_id=b2e092df-3af7-4fc1-9b40-8f699ae1c976&type=agent&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1"
200
INFO 127.0.0.1:60530 - "GET /sessions/b2e092df-3af7-4fc1-9b40-8f699ae1c976/runs?session_id=b2e092df-3af7-4fc1-9b40-8f699ae1c976&type=agent&db_id=21138089-9477-5cb5-98c0-fdc32ef6f1e0 HTTP/1.1" 200