Skip to main content
In this guide, you’ll build an agent that:
  • Connects to an MCP server
  • Stores and retrieves past conversations
  • Runs as a production API
All in about 20 lines of code.

1. Define the Agent

Save the following code as agno_assist.py:
agno_assist.py
You now have:
  • A stateful agent
  • Streaming responses
  • Per-user session isolation
  • A production-ready API
  • Tracing enabled out of the box
No 3rd-party services required

2. Run Your AgentOS

1

Set up your virtual environment

2

Install dependencies

3

Export your Anthropic API key

4

Run your AgentOS

Your AgentOS is now running at:http://localhost:8000API documentation is automatically available at:http://localhost:8000/docs
You can add your own routes, middleware, or any FastAPI feature on top.

3. Connect to the AgentOS UI

The AgentOS UI connects directly from your browser to your runtime. It lets you test, monitor, and manage your agents in real time.
  1. Open os.agno.com and sign in.
  2. Click “Add new OS” in the top navigation.
  3. Select “Local” to connect to a local AgentOS.
  4. Enter your endpoint URL (default: http://localhost:8000).
  5. Name it something like “Development OS”.
  6. Click “Connect”.
You’ll see your OS with a live status indicator once connected.

Chat with your Agent

Open Chat, select your agent, and ask:
What is Agno?
The agent retrieves context from the Agno MCP server and responds with grounded answers.
Click Sessions in the sidebar to inspect stored conversations.All session data is stored in your local database. No third-party tracing or hosted memory service is required.

What You Just Built

In 20 lines, you built:
  • A stateful agent
  • Tool-augmented retrieval via MCP
  • A streaming API
  • Session isolation
  • A production-ready runtime
You can use this exact same architecture for running multi-agent systems in production.

Next