Chapter 1 · Agent Application Development and Agno Overview
Learning objectives: Understand the essential difference between LLM applications and AI Agents, grasp Agno's positioning and core components, and build a mental map for the 27 hands-on chapters ahead.
1.1 From LLM Calls to Agents
Calling an LLM API directly (e.g., sending text to DeepSeek and getting a reply back) can only solve "one question, one answer" problems. Real business needs multi-step work: query data first, then compute, then summarize. Encapsulating this "perceive → decide → act → observe results → decide again" loop is what makes an Agent.
A typical Agent is composed of five building blocks:
| Block | Role | Analogy |
|---|---|---|
| Model | Handles "thinking"; produces text or tool calls | Brain |
| Tools | Lets the model check weather, search the web, call APIs | Hands |
| Memory | Remembers user preferences and facts across sessions | Long-term memory |
| Knowledge Base | Injects domain materials via retrieval (RAG) | Reference bookshelf |
| Storage (DB) | Persists session history so conversations can resume | Notebook |
The Agent run loop can be summarized in one sentence: build context and send it to the model → model either answers or requests tool calls → execute tools and feed results back → loop until the model stops calling tools → return the final answer. In pseudocode:
# Agent run loop skeleton (pseudocode)
def agent_loop(user_input):
messages = build_context(user_input) # 1. Build context
while True:
reply = model(messages) # 2. Request from model
if reply.tool_calls: # 3. Model wants to call tools
results = run_tools(reply.tool_calls)
messages.append(results) # 4. Feed tool results back, continue loop
else:
return reply.text # 5. No tool calls → final answerOnce you understand this loop, every chapter ahead is just upgrading one of these five blocks.
1.2 What Is Agno
Agno is an open-source Python Agent framework. The current major version is Agno 3.x (this tutorial has been verified against the official docs for agno 3.x). The official positioning spans three layers:
- Agent SDK — define an Agent in a few lines of Python;
- Agent Runtime — runtime for multi-agent Teams and step-by-step Workflows;
- Control Plane (AgentOS) — turn your Agent into a FastAPI service with one command, providing session isolation, monitoring, evaluations, and other production capabilities.
Why choose Agno to get started
Compared to LangChain's "chain abstraction," Agno deliberately lets you write AI logic using plain Python constructs (if/else, functions, classes) — fewer concepts, faster onboarding. It also ships built-in production features like memory, knowledge base, storage, and human-in-the-loop, so you never need to switch frameworks from toy to production.
1.3 Core Components Overview
The code below is the "minimum viable Agent" from the Agno official docs, adapted to connect to DeepSeek (an OpenAI-compatible third-party model) — this is the unified pattern used throughout the book:
# first_agent.py
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
# Connect to any OpenAI-compatible endpoint using OpenAIChat (DeepSeek shown here)
model=OpenAIChat(
id="deepseek-chat",
api_key=os.getenv("DEEPSEEK_API_KEY"),
base_url="https://api.deepseek.com/v1",
),
tools=[DuckDuckGoTools()], # Built-in search toolkit
instructions=["Search before answering", "Cite sources at the end of your answer"],
markdown=True, # Render output as Markdown
)
agent.print_response("What is the latest version of the Agno framework?", stream=True)对照 1.1 的表格,这段代码已经用到了三块积木:模型(model)、工具(tools)、指令(instructions)。后续章节会逐一补齐其余部分:
- Collaboration & orchestration → Team: Chapters 9–10; Workflow: Chapters 11–12;
- Multimodal → Chapter 13; Sessions & state → Chapter 14; Storage → Chapter 15; Memory → Chapter 16;
- Knowledge base / RAG → Chapters 17–18; Reasoning models & Skills → Chapters 19–20;
- Human-in-the-loop / Guardrails → Chapter 21; MCP → Chapter 22; AgentOS service → Chapter 23.
1.4 The Five Blocks in Code
All five blocks map to parameters on the Agno Agent constructor. Get familiar with them now; we'll go hands-on with each in later chapters:
# components_map.py —— Mapping of the five blocks to Agent constructor params (示意 only, do not run)
Agent(
model=OpenAIChat(id="deepseek-chat"), # Model
tools=[DuckDuckGoTools()], # Tools
db=SqliteDb(db_file="app.db"), # Storage: session persistence
# memory=MemoryManager(...), # Memory (Chapter 16)
# knowledge=Knowledge(...), # Knowledge base (Chapter 17)
)1.5 How Agno Differs from Traditional Chain Frameworks
Beginners often ask: "LangChain/LangGraph can also build Agents — why use Agno?" The differences are mainly threefold:
- Abstraction level: Chain frameworks compose flows into "chain/graph" nodes; Agno advocates writing Python control flow directly — when debugging, you're looking at plain code.
- Built-in completeness: Agno bundles session storage, user memory, vector knowledge bases, Guardrails, MCP, and AgentOS service publishing as out-of-the-box components — no need to assemble a dozen integration packages yourself.
- Performance orientation: The official docs stress that Agent instantiation is microsecond-level with minimal memory footprint, ideal for high-concurrency scenarios with many short-lived Agents.
Of course, no framework is a silver bullet: if your scenario is a complex deterministic state machine, a Workflow (Chapter 11) paired with plain functions is more suitable — which is precisely why Agno offers three orchestration shapes (single Agent / Team / Workflow).
1.6 Learning Path and Environment Setup
This course starts from zero. The path is:
- Getting started (Chapters 01–06): Environment setup, running models, streaming output, structured output, prompt design;
- Collaboration & orchestration (Chapters 07–12): Tool system, multi-agent Teams, Workflow编排;
- Data & memory (Chapters 13–18): Multimodal, session state, storage, memory, and knowledge base RAG;
- Advanced models & extensions (Chapters 19–20): Reasoning models, Skills plugin system;
- Safety & ecosystem (Chapters 21–22): Guardrails human-in-the-loop, MCP protocol;
- Production practice (Chapters 23–25): AgentOS service, observability, performance optimization;
- Capstone projects (Chapters 26–28): Data analysis assistant, multi-source research Team, customer-service KB on AgentOS.
First, get the environment ready (Chapter 2 goes into detail):
python -m venv .venv && source .venv/bin/activate
pip install -U agno python-dotenv# check_env.py —— Verify installation
import agno
print("agno version:", agno.__version__) # Should output 3.x.x1.7 Chapter Summary
- LLM APIs are "one question, one answer"; Agents are autonomous systems with tool-call loops;
- The five Agent building blocks: Model, Tools, Memory, Knowledge Base, Storage;
- Agno = Agent SDK + Runtime + AgentOS control plane, advocating plain Python for AI logic;
- All examples in this book use
OpenAIChat(base_url=...)to connect to third-party OpenAI-compatible models.
🧪 随堂测验
点击你认为正确的选项。答错时会展示正确答案与原因解析。
1. Which of the following is NOT a step in the Agent run loop?
2. In this tutorial, what is the recommended way to connect to DeepSeek (an OpenAI-compatible model)?
3. Which statement about Agno's overall positioning is correct?
4. What is the difference between "Knowledge Base (Knowledge)" and "Memory" in an Agent?
🛠️ Hands-On Exercises
- Install agno and run
check_env.py; record your version number — upgrade if below 3.x. - Copy and run the
first_agent.pyfrom section 1.3 (requires setting theDEEPSEEK_API_KEYenv var); watch the tool-call process in the terminal. - Draw a flowchart of the "Agent run loop" in your understanding (on paper or any drawing tool), marking where context building happens.
Ready? Head to Chapter 2: Environment Setup and Your First Agent.