Agents are AI programs where a language model controls the flow of execution. In 10 lines of code, we can build an Agent that takes action based on user input and available tools. This agent will fetch the top stories from HackerNews and summarize them.
hackernews_agent.py
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    model=Claude(id="claude-sonnet-4-0"),
    tools=[HackerNewsTools()],
    markdown=True,
)
agent.print_response("Summarize the top 5 stories on hackernews", stream=True)

Build your first Agent

Instead of a toy demo, let’s build an Agent that your can extend and build upon. We’ll connect our agent to Agno’s documentation via an 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
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.anthropic import Claude
from agno.os import AgentOS
from agno.tools.mcp import MCPTools

# Create the Agent
agno_agent = Agent(
    name="Agno Agent",
    model=Claude(id="claude-sonnet-4-0"),
    # 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="https://docs.agno.com/mcp")],
    # Add the previous session history to the context
    add_history_to_context=True,
    markdown=True,
)


# Create the AgentOS
agent_os = AgentOS(agents=[agno_agent])
# Get the FastAPI app for the AgentOS
app = agent_os.get_app()
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

uv venv --python 3.12
source .venv/bin/activate
2

Install dependencies

uv pip install -U agno anthropic mcp 'fastapi[standard]' sqlalchemy
3

Export your Anthropic API key

export ANTHROPIC_API_KEY=sk-***
4

Run your AgentOS

fastapi dev agno_agent.py
This will start your AgentOS on 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.
  1. Click on “Add new OS” in the top navigation bar.
  2. Select “Local” to connect to a local AgentOS running on your machine.
  3. Enter the endpoint URL of your AgentOS. The default is http://localhost:8000.
  4. Give your AgentOS a descriptive name like “Development OS” or “Local 8000”.
  5. Click “Connect”.
Once connected, you’ll see your new OS with a live status indicator.

Chat with your Agent

Next, let’s chat with our Agent, go to the Chat 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.

Next

After running your AgentOS, dive into core concepts and extend your Agents with more capabilities. Happy building!