Build your first Agent
Agents are AI programs where a language model controls the flow of execution. Let’s build an Agent that connects to an MCP server, persists conversation state, and is served via FastAPI. Save the following code asagno_agent.py:
agno_agent.py
In ~20 lines, you have an Agent with memory, state, and MCP tools — served via FastAPI app with pre-built endpoints ready for your product.
Run your AgentOS
1
Set up your virtual environment
2
Install dependencies
3
Export your Anthropic API key
4
Run your AgentOS
http://localhost:8000.Connect to the AgentOS UI
The AgentOS UI connects directly to your runtime, letting you monitor, manage, and test your system.- Open os.agno.com and sign in.
- Click “Add new OS” in the top navigation.
- Select “Local” to connect to a local AgentOS.
- Enter your endpoint URL (default:
http://localhost:8000). - Name it something like “Development OS”.
- Click “Connect”.
Chat with your Agent
Go to Chat in the sidebar and select your Agent.- Ask “What is Agno?” and the Agent will answer using the Agno MCP server.
- Each Agent maintains its own history, tools, and instructions—switching users won’t mix context.
Pre-built API endpoints
The FastAPI app includes SSE-compatible endpoints you can build on. Add your own routes, middleware, or any FastAPI feature. Check out the API docs athttp://localhost:8000/docs.
Next steps
- Learn how to build agents with more features
- Explore examples for inspiration
- Read the full documentation to go deeper