Build your first Agent
Agents are AI programs where a language model controls the flow of execution. Instead of a toy demo, let’s build an Agent that you can extend by connecting to any MCP server. We’ll connect our agent to the Agno MCP server, and give it a database to store conversation history and state. Save the following code in a file namedagno_agent.py
agno_agent.py
There is an incredible amount of alpha in these 25 lines of code.You get a fully functional Agent with memory and state that can access any MCP server. It’s served via a FastAPI app with pre-built endpoints that you can use to build your product.
Run your AgentOS
The AgentOS gives us a FastAPI application with ready-to-use API endpoints. Let’s run it.1
Setup your virtual environment
2
Install dependencies
3
Export your Anthropic API key
4
Run your AgentOS
http://localhost:8000Connect your AgentOS
Agno provides a beautiful web interface that connects directly to your AgentOS, use it to monitor, manage and test your agentic system. Open os.agno.com and sign in to your account.- Click on “Add new OS” in the top navigation bar.
- Select “Local” to connect to a local AgentOS running on your machine.
- Enter the endpoint URL of your AgentOS. The default is
http://localhost:8000. - Give your AgentOS a descriptive name like “Development OS” or “Local 8000”.
- Click “Connect”.
Chat with your Agent
Next, let’s chat with our Agent, go to theChat section in the sidebar and select your Agent.
- Ask “What is Agno?” and the Agent will answer using the Agno MCP server.
- Agents keep their own history, tools, and instructions; switching users won’t mix context.
Pre-built API endpoints
The FastAPI app generated by your AgentOS comes with pre-built SSE-compatible API endpoints that you can build your product on top of. You can add your own routes, middleware or any other FastAPI feature. Checkout the API endpoints at/docs of your AgentOS url, e.g. http://localhost:8000/docs
Next
- Learn how to build agents with more features
- Explore examples for inspiration
- Read the full documentation to dive deeper