A step-by-step tour of building AI agents with Agno.
Each script adds one harness capability on top of the last. Every example runs on a local model, with no API keys needed.
A model on its own only predicts text. The harness is everything around it that turns it into an agent: tools, schemas, storage, memory, state, knowledge, guardrails, human approval, and coordination with other agents. This repo builds that harness one layer at a time.
flowchart LR
U([User]) --> G[Guardrails]
G --> A{{Agent<br/>qwen via Ollama}}
A <--> T[Tools<br/>YFinance]
A <--> K[(Knowledge<br/>ChromaDB)]
A <--> M[(Storage · Memory · State<br/>SQLite)]
A -. approval .-> H([Human])
A --> O([Typed output])
| # | Script | Capability | What you learn |
|---|---|---|---|
| 1 | 1-Agent-with-tools.py |
Tools | Give an agent live market data through YFinanceTools |
| 2 | 2-Agent-with-structured-output.py |
Structured output | Return a Pydantic StockAnalysis instead of free text |
| 3 | 3-Agent-with-typed-input-output.py |
Typed I/O | Validate the request and the response with schemas |
| 4 | 4-Agent-with-storage.py |
Storage | Persist chat history in SQLite and resume a session across runs |
| 5 | 5-Agent-with-memory.py |
Memory | Remember user preferences across all conversations |
| 6 | 6-Agent-with-state-management.py |
State | Keep a watchlist the agent reads and edits through tools |
| 7 | 7-Agent-search-over-knowledge.py |
Knowledge / RAG | Hybrid search over ChromaDB with nomic-embed-text embeddings |
| 8 | 8-Agent-with-learning.py |
Learning | Store reusable insights that help future users and sessions |
| 9 | 9-Agent-with-guardrails.py |
Guardrails | Block PII and prompt injection, and write a custom guardrail |
| 10 | 10-Agent-Human-in-loop.py |
Human-in-the-loop | Pause before a sensitive tool call and approve or reject it |
| 11 | 11-Multi-Agent-team.py |
Teams | Bull vs. bear analysts, with a lead that writes the verdict |
| 12 | 12-Multi-Agent-Sequencial-Workflow.py |
Workflows | A step-by-step research pipeline with explicit data flow |
| 13 | 13-Agentos-AGUI.py |
AgentOS + AG-UI | Serve an agent as an API with a chat UI protocol |
| Scope | Holds | Example | |
|---|---|---|---|
| Storage | one session | the conversation history | "Compare that to Tesla" |
| Memory | one user | facts about the user | "I prefer dividend stocks" |
| State | one session | structured data the agent edits | watchlist = ["NVDA", "AMD"] |
| Learning | all users | general lessons | "Check debt ratios for utilities" |
1. Requirements: uv, Ollama, and Python 3.14 (uv installs it for you).
2. Pull the models
ollama pull qwen3.5:4b # chat model
ollama pull nomic-embed-text # embeddings for examples 7 and 8The scripts use the tag qwen3.5-4b-16k, which is qwen with a 16k context window. Create it once:
printf 'FROM qwen3.5:4b\nPARAMETER num_ctx 16384\n' > Modelfile
ollama create qwen3.5-4b-16k -f ModelfileUsing a different model? Change
Ollama(id="...")in the scripts.
3. Install and run
git clone https://github.com/ashishpatel26/Agent-harness-using-Agno.git
cd Agent-harness-using-Agno
uv sync
uv run 1-Agent-with-tools.pyRun the examples in order: each one builds on the ideas of the previous script.
.
├── 1-…13-*.py # the examples, in learning order
├── data/ # source documents for the knowledge base
├── db/ # SQLite + ChromaDB files (created at runtime, git-ignored)
├── assets/banner.svg
└── pyproject.toml
Agno (agents, teams, workflows, AgentOS) · Ollama (local LLM and embeddings) · ChromaDB (vector store) · SQLite (sessions, memory, state) · yfinance (market data) · Pydantic · FastAPI
The finance examples are for learning only. They are not investment advice, and market data from Yahoo Finance can be delayed or incomplete.
If this helped you learn agent engineering, consider giving it a ⭐