hackernews_agent.py
Build your first Agent
Instead of a toy demo, let’s build an Agent that you can extend and build upon. We’ll connect our agent to the Agno MCP server, and give it a database to store conversation history and state. This is a simple yet complete example that you can extend by connecting to any MCP server.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 for serving, monitoring and managing our Agents. Let’s run it.1
Setup your virtual environment
2
Install dependencies
3
Export your Anthropic API key
4
Run your AgentOS
http://localhost:8000
Connect your AgentOS
Agno provides a web interface that connects 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.
Click on Sessions to view your Agent’s conversations. This data is stored in your Agent’s database, so no need for external tracing services.
Pre-built API endpoints
The FastAPI app generated by your AgentOS comes with pre-built SSE-compatible API endpoints that you can use to build your product. You can always add your own routes, middleware or any other FastAPI feature, but this is such a great starting point. Checkout the API endpoints at/docs
of your AgentOS url, e.g. http://localhost:8000/docs