The Agent API workspace provides a simple RestAPI + database for serving agents. It contains:

  • A FastAPI server for serving Agents, Teams and Workflows.
  • A postgres database for session and vector storage.

Setup

1

Create and activate a virtual environment

python3 -m venv .venv
source .venv/bin/activate
2

Install Agno

pip install -U "agno[aws]"
3

Install uv and docker

  • Install uv for managing your python environment.
curl -LsSf https://astral.sh/uv/install.sh | sh
4

Export your OpenAI key

export OPENAI_API_KEY=sk-***

Agno works with any model provider, just need to update the agents in the workspace.

Create your Agent API codebase

Create your codebase using the agent-api template, give it any name you like.

ag ws create --template agent-api --name agent-api

This will create a folder agent-api with the following structure:

agent-api                     # root directory
├── agents                  # add your Agents here
├── api                     # add fastApi routes here
├── db                      # add database tables here
├── Dockerfile              # Dockerfile for the application
├── pyproject.toml          # python project definition
├── requirements.txt        # python dependencies generated by pyproject.toml
├── scripts                 # helper scripts
├── utils                   # shared utilities
└── workspace               # agno workspace directory
    ├── dev_resources.py    # dev resources running locally
    ├── prd_resources.py    # production resources running on AWS
    ├── secrets             # secrets
    └── settings.py         # agno workspace settings

Run your Agent Api locally

cd into the agent-api folder

cd agent-api

Start your Agent Api using the following command:

ag ws up

Press Enter to confirm and give a few seconds for the image to download (only the first time). Verify container status and view logs on the docker dashboard.

Notes:

  • The Agents are defined in the agents folder.
  • The api routes are defined in the api folder.

Stop local workspace

Play around and stop the workspace using:

ag ws down

Next

Congratulations on running your Agent API locally. Next Steps: