agno

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agno Skill

Agno Skill

Comprehensive assistance with Agno development - a modern AI agent framework for building production-ready multi-agent systems with MCP integration, workflow orchestration, and AgentOS runtime.
为Agno开发提供全面支持——这是一款现代化的AI Agent框架,用于构建可投入生产的多智能体系统,支持MCP集成、工作流编排和AgentOS运行时。

When to Use This Skill

何时使用本Skill

This skill should be triggered when:
  • Building AI agents with tools, memory, and structured outputs
  • Creating multi-agent teams with role-based delegation and collaboration
  • Implementing workflows with conditional branching, loops, and async execution
  • Integrating MCP servers (stdio, SSE, or Streamable HTTP transports)
  • Deploying AgentOS with custom FastAPI apps, JWT middleware, or database backends
  • Working with knowledge bases for RAG and document processing
  • Debugging agent behavior with debug mode and telemetry
  • Optimizing agent performance with exponential backoff, retries, and rate limiting
在以下场景中应触发本Skill:
  • 构建AI Agent:具备工具、记忆和结构化输出功能
  • 创建多智能体团队:基于角色的任务分配与协作
  • 实现工作流:支持条件分支、循环和异步执行
  • 集成MCP服务器(stdio、SSE或Streamable HTTP传输协议)
  • 部署AgentOS:搭配自定义FastAPI应用、JWT中间件或数据库后端
  • 使用知识库:用于RAG(检索增强生成)和文档处理
  • 调试Agent行为:借助调试模式和遥测功能
  • 优化Agent性能:使用指数退避、重试和速率限制机制

Key Concepts

核心概念

Core Architecture

核心架构

  • Agent: Single autonomous AI unit with model, tools, instructions, and optional memory/knowledge
  • Team: Collection of agents that collaborate on tasks with role-based delegation
  • Workflow: Multi-step orchestration with conditional branching, loops, and parallel execution
  • AgentOS: FastAPI-based runtime for deploying agents as production APIs
  • Agent:单个自主AI单元,包含模型、工具、指令,可选记忆/知识库
  • Team:多个Agent的集合,基于角色分配协作完成任务
  • Workflow:多步骤编排,支持条件分支、循环和并行执行
  • AgentOS:基于FastAPI的运行时,用于将Agent部署为生产级API

MCP Integration

MCP集成

  • MCPTools: Connect to single MCP server via stdio, SSE, or Streamable HTTP
  • MultiMCPTools: Connect to multiple MCP servers simultaneously
  • Transport Types: stdio (local processes), SSE (server-sent events), Streamable HTTP (production)
  • MCPTools:通过stdio、SSE或Streamable HTTP连接单个MCP服务器
  • MultiMCPTools:同时连接多个MCP服务器
  • 传输类型:stdio(本地进程)、SSE(服务器发送事件)、Streamable HTTP(生产环境)

Memory & Knowledge

记忆与知识库

  • Session Memory: Conversation state stored in PostgreSQL, SQLite, or cloud storage (GCS)
  • Knowledge Base: RAG-powered document retrieval with vector embeddings
  • User Memory: Persistent user-specific memories across sessions
  • 会话记忆:对话状态存储于PostgreSQL、SQLite或云存储(GCS)
  • 知识库:基于向量嵌入的RAG文档检索
  • 用户记忆:跨会话的持久化用户专属记忆

Quick Reference

快速参考

1. Basic Agent with Tools

1. 带工具的基础Agent

python
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    tools=[DuckDuckGoTools()],
    markdown=True,
)

agent.print_response("Search for the latest AI news", stream=True)
python
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    tools=[DuckDuckGoTools()],
    markdown=True,
)

agent.print_response("Search for the latest AI news", stream=True)

2. Agent with Structured Output

2. 带结构化输出的Agent

python
from agno.agent import Agent
from pydantic import BaseModel, Field


class MovieScript(BaseModel):
    name: str = Field(..., description="Movie title")
    genre: str = Field(..., description="Movie genre")
    storyline: str = Field(..., description="3 sentence storyline")


agent = Agent(
    description="You help people write movie scripts.",
    output_schema=MovieScript,
)

result = agent.run("Write a sci-fi thriller")
print(result.content.name)  # Access structured output
python
from agno.agent import Agent
from pydantic import BaseModel, Field


class MovieScript(BaseModel):
    name: str = Field(..., description="Movie title")
    genre: str = Field(..., description="Movie genre")
    storyline: str = Field(..., description="3 sentence storyline")


agent = Agent(
    description="You help people write movie scripts.",
    output_schema=MovieScript,
)

result = agent.run("Write a sci-fi thriller")
print(result.content.name)  # Access structured output

3. MCP Server Integration (stdio)

3. MCP服务器集成(stdio)

python
import asyncio
from agno.agent import Agent
from agno.tools.mcp import MCPTools


async def run_agent(message: str) -> None:
    mcp_tools = MCPTools(command="uvx mcp-server-git")
    await mcp_tools.connect()

    try:
        agent = Agent(tools=[mcp_tools])
        await agent.aprint_response(message, stream=True)
    finally:
        await mcp_tools.close()


asyncio.run(run_agent("What is the license for this project?"))
python
import asyncio
from agno.agent import Agent
from agno.tools.mcp import MCPTools


async def run_agent(message: str) -> None:
    mcp_tools = MCPTools(command="uvx mcp-server-git")
    await mcp_tools.connect()

    try:
        agent = Agent(tools=[mcp_tools])
        await agent.aprint_response(message, stream=True)
    finally:
        await mcp_tools.close()


asyncio.run(run_agent("What is the license for this project?"))

4. Multiple MCP Servers

4. 多MCP服务器

python
import asyncio
import os
from agno.agent import Agent
from agno.tools.mcp import MultiMCPTools


async def run_agent(message: str) -> None:
    env = {
        **os.environ,
        "GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
    }

    mcp_tools = MultiMCPTools(
        commands=[
            "npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt",
            "npx -y @modelcontextprotocol/server-google-maps",
        ],
        env=env,
    )
    await mcp_tools.connect()

    try:
        agent = Agent(tools=[mcp_tools], markdown=True)
        await agent.aprint_response(message, stream=True)
    finally:
        await mcp_tools.close()
python
import asyncio
import os
from agno.agent import Agent
from agno.tools.mcp import MultiMCPTools


async def run_agent(message: str) -> None:
    env = {
        **os.environ,
        "GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
    }

    mcp_tools = MultiMCPTools(
        commands=[
            "npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt",
            "npx -y @modelcontextprotocol/server-google-maps",
        ],
        env=env,
    )
    await mcp_tools.connect()

    try:
        agent = Agent(tools=[mcp_tools], markdown=True)
        await agent.aprint_response(message, stream=True)
    finally:
        await mcp_tools.close()

5. Multi-Agent Team with Role Delegation

5. 带角色分配的多智能体团队

python
from agno.agent import Agent
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools

research_agent = Agent(
    name="Research Specialist",
    role="Gather information on topics",
    tools=[DuckDuckGoTools()],
    instructions=["Find comprehensive information", "Cite sources"],
)

news_agent = Agent(
    name="News Analyst",
    role="Analyze tech news",
    tools=[HackerNewsTools()],
    instructions=["Focus on trending topics", "Summarize key points"],
)

team = Team(
    members=[research_agent, news_agent],
    instructions=["Delegate research tasks to appropriate agents"],
)

team.print_response("Research AI trends and latest HN discussions", stream=True)
python
from agno.agent import Agent
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools

research_agent = Agent(
    name="Research Specialist",
    role="Gather information on topics",
    tools=[DuckDuckGoTools()],
    instructions=["Find comprehensive information", "Cite sources"],
)

news_agent = Agent(
    name="News Analyst",
    role="Analyze tech news",
    tools=[HackerNewsTools()],
    instructions=["Focus on trending topics", "Summarize key points"],
)

team = Team(
    members=[research_agent, news_agent],
    instructions=["Delegate research tasks to appropriate agents"],
)

team.print_response("Research AI trends and latest HN discussions", stream=True)

6. Workflow with Conditional Branching

6. 带条件分支的工作流

python
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.router import Router
from agno.workflow.step import Step
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools

simple_researcher = Agent(
    name="Simple Researcher",
    tools=[DuckDuckGoTools()],
)

deep_researcher = Agent(
    name="Deep Researcher",
    tools=[HackerNewsTools()],
)

workflow = Workflow(
    steps=[
        Router(
            routes={
                "simple_topics": Step(agent=simple_researcher),
                "complex_topics": Step(agent=deep_researcher),
            }
        )
    ]
)

workflow.run("Research quantum computing")
python
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.router import Router
from agno.workflow.step import Step
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools

simple_researcher = Agent(
    name="Simple Researcher",
    tools=[DuckDuckGoTools()],
)

deep_researcher = Agent(
    name="Deep Researcher",
    tools=[HackerNewsTools()],
)

workflow = Workflow(
    steps=[
        Router(
            routes={
                "simple_topics": Step(agent=simple_researcher),
                "complex_topics": Step(agent=deep_researcher),
            }
        )
    ]
)

workflow.run("Research quantum computing")

7. Agent with Database Session Storage

7. 带数据库会话存储的Agent

python
from agno.agent import Agent
from agno.db.postgres import PostgresDb

db = PostgresDb(
    db_url="postgresql://user:pass@localhost:5432/agno", schema="agno_sessions"
)

agent = Agent(
    db=db,
    session_id="user-123",  # Persistent session
    add_history_to_messages=True,
)
python
from agno.agent import Agent
from agno.db.postgres import PostgresDb

db = PostgresDb(
    db_url="postgresql://user:pass@localhost:5432/agno", schema="agno_sessions"
)

agent = Agent(
    db=db,
    session_id="user-123",  # Persistent session
    add_history_to_messages=True,
)

Conversations are automatically saved and restored

Conversations are automatically saved and restored

agent.print_response("Remember my favorite color is blue") agent.print_response("What's my favorite color?") # Will remember
undefined
agent.print_response("Remember my favorite color is blue") agent.print_response("What's my favorite color?") # Will remember
undefined

8. AgentOS with Custom FastAPI App

8. 带自定义FastAPI应用的AgentOS

python
from fastapi import FastAPI
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
python
from fastapi import FastAPI
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.os import AgentOS

Custom FastAPI app

Custom FastAPI app

app = FastAPI(title="Custom App")
@app.get("/health") def health_check(): return {"status": "healthy"}
app = FastAPI(title="Custom App")
@app.get("/health") def health_check(): return {"status": "healthy"}

Add AgentOS routes

Add AgentOS routes

agent_os = AgentOS( agents=[Agent(id="assistant", model=OpenAIChat(id="gpt-5-mini"))], base_app=app, # Merge with custom app )
if name == "main": agent_os.serve(app="custom_app:app", reload=True)
undefined
agent_os = AgentOS( agents=[Agent(id="assistant", model=OpenAIChat(id="gpt-5-mini"))], base_app=app, # Merge with custom app )
if name == "main": agent_os.serve(app="custom_app:app", reload=True)
undefined

9. Agent with Debug Mode

9. 带调试模式的Agent

python
from agno.agent import Agent
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    tools=[HackerNewsTools()],
    debug_mode=True,  # Enable detailed logging
    # debug_level=2,  # More verbose output
)
python
from agno.agent import Agent
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    tools=[HackerNewsTools()],
    debug_mode=True,  # Enable detailed logging
    # debug_level=2,  # More verbose output
)

See detailed logs of:

See detailed logs of:

- Messages sent to model

- Messages sent to model

- Tool calls and results

- Tool calls and results

- Token usage and timing

- Token usage and timing

agent.print_response("Get top HN stories")
undefined
agent.print_response("Get top HN stories")
undefined

10. Workflow with Input Schema Validation

10. 带输入 Schema 验证的工作流

python
from typing import List
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.step import Step
from pydantic import BaseModel, Field


class ResearchTopic(BaseModel):
    """Structured research topic with specific requirements"""

    topic: str
    focus_areas: List[str] = Field(description="Specific areas to focus on")
    target_audience: str = Field(description="Who this research is for")
    sources_required: int = Field(description="Number of sources needed", default=5)


workflow = Workflow(
    input_schema=ResearchTopic,  # Validate inputs
    steps=[Step(agent=Agent(instructions=["Research based on focus areas"]))],
)
python
from typing import List
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.step import Step
from pydantic import BaseModel, Field


class ResearchTopic(BaseModel):
    """Structured research topic with specific requirements"""

    topic: str
    focus_areas: List[str] = Field(description="Specific areas to focus on")
    target_audience: str = Field(description="Who this research is for")
    sources_required: int = Field(description="Number of sources needed", default=5)


workflow = Workflow(
    input_schema=ResearchTopic,  # Validate inputs
    steps=[Step(agent=Agent(instructions=["Research based on focus areas"]))],
)

This will validate the input structure

This will validate the input structure

workflow.run( { "topic": "AI Safety", "focus_areas": ["alignment", "interpretability"], "target_audience": "researchers", "sources_required": 10, } )
undefined
workflow.run( { "topic": "AI Safety", "focus_areas": ["alignment", "interpretability"], "target_audience": "researchers", "sources_required": 10, } )
undefined

Reference Files

参考文档

This skill includes comprehensive documentation in
references/
:
本Skill在
references/
目录下包含全面的文档:

agentos.md (22 pages)

agentos.md(22页)

  • MCP server integration (stdio, SSE, Streamable HTTP)
  • Multiple MCP server connections
  • Custom FastAPI app integration
  • JWT middleware and authentication
  • AgentOS lifespan management
  • Telemetry and monitoring
  • MCP服务器集成(stdio、SSE、Streamable HTTP)
  • 多MCP服务器连接
  • 自定义FastAPI应用集成
  • JWT中间件与身份认证
  • AgentOS生命周期管理
  • 遥测与监控

agents.md (834 pages)

agents.md(834页)

  • Agent creation and configuration
  • Tools integration (DuckDuckGo, HackerNews, Pandas, PostgreSQL, Wikipedia)
  • Structured outputs with Pydantic
  • Memory management (session, user, knowledge)
  • Debugging with debug mode
  • Human-in-the-loop patterns
  • Multimodal agents (audio, video, images)
  • Database backends (PostgreSQL, SQLite, GCS)
  • State management and session persistence
  • Agent创建与配置
  • 工具集成(DuckDuckGo、HackerNews、Pandas、PostgreSQL、Wikipedia)
  • 基于Pydantic的结构化输出
  • 记忆管理(会话、用户、知识库)
  • 调试模式调试
  • 人在回路模式
  • 多模态Agent(音频、视频、图像)
  • 数据库后端(PostgreSQL、SQLite、GCS)
  • 状态管理与会话持久化

examples.md (188 pages)

examples.md(188页)

  • Workflow patterns (conditional branching, loops, routers)
  • Team collaboration examples
  • Async streaming workflows
  • Audio/video processing teams
  • Image generation pipelines
  • Multi-step orchestration
  • Input schema validation
  • 工作流模式(条件分支、循环、路由)
  • 团队协作示例
  • 异步流式工作流
  • 音视频处理团队
  • 图像生成流水线
  • 多步骤编排
  • 输入Schema验证

getting_started.md

getting_started.md

  • Installation and setup
  • First agent examples
  • MCP server quickstarts
  • Common patterns and best practices
  • 安装与设置
  • 首个Agent示例
  • MCP服务器快速入门
  • 常见模式与最佳实践

integration.md

integration.md

  • Third-party integrations
  • API connections
  • Custom tool creation
  • Database setup
  • 第三方集成
  • API连接
  • 自定义工具创建
  • 数据库设置

migration.md

migration.md

  • Upgrading between versions
  • Breaking changes and migration guides
  • Deprecated features
  • 版本升级
  • 破坏性变更与迁移指南
  • 已弃用功能

other.md

other.md

  • Advanced topics
  • Performance optimization
  • Production deployment
  • 高级主题
  • 性能优化
  • 生产环境部署

Working with This Skill

使用本Skill的指南

For Beginners

面向初学者

Start with getting_started.md to understand:
  • Basic agent creation with
    Agent()
  • Adding tools for web search, databases, etc.
  • Running agents with
    .print_response()
    or
    .run()
  • Understanding the difference between Agent, Team, and Workflow
Quick Start Pattern:
python
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(tools=[DuckDuckGoTools()])
agent.print_response("Your question here")
getting_started.md开始,了解:
  • 使用
    Agent()
    创建基础Agent
  • 添加网页搜索、数据库等工具
  • 使用
    .print_response()
    .run()
    运行Agent
  • 理解Agent、Team和Workflow的区别
快速入门模板:
python
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(tools=[DuckDuckGoTools()])
agent.print_response("Your question here")

For Intermediate Users

面向中级用户

Explore agents.md and examples.md for:
  • Multi-agent teams with role delegation
  • MCP server integration (local tools via stdio)
  • Workflow orchestration with conditional logic
  • Session persistence with databases
  • Structured outputs with Pydantic models
Team Pattern:
python
from agno.team import Team

team = Team(
    members=[researcher, analyst, writer],
    instructions=["Delegate tasks based on agent roles"],
)
探索agents.mdexamples.md,学习:
  • 带角色分配的多智能体团队
  • MCP服务器集成(通过stdio连接本地工具)
  • 带条件逻辑的工作流编排
  • 基于数据库的会话持久化
  • 基于Pydantic模型的结构化输出
团队模板:
python
from agno.team import Team

team = Team(
    members=[researcher, analyst, writer],
    instructions=["Delegate tasks based on agent roles"],
)

For Advanced Users

面向高级用户

Deep dive into agentos.md for:
  • AgentOS deployment with custom FastAPI apps
  • Multiple MCP server orchestration
  • Production authentication with JWT middleware
  • Custom lifespan management
  • Performance tuning with exponential backoff
  • Telemetry and monitoring integration
AgentOS Pattern:
python
from agno.os import AgentOS

agent_os = AgentOS(
    agents=[agent1, agent2], db=PostgresDb(...), base_app=custom_fastapi_app
)
agent_os.serve()
深入研究agentos.md,掌握:
  • 搭配自定义FastAPI应用的AgentOS部署
  • 多MCP服务器编排
  • 生产环境JWT中间件身份认证
  • 自定义生命周期管理
  • 指数退避性能调优
  • 遥测与监控集成
AgentOS模板:
python
from agno.os import AgentOS

agent_os = AgentOS(
    agents=[agent1, agent2], db=PostgresDb(...), base_app=custom_fastapi_app
)
agent_os.serve()

Navigation Tips

导航技巧

  1. Looking for examples? → Check
    examples.md
    first for real-world patterns
  2. Need API details? → Search
    agents.md
    for class references and parameters
  3. Deploying to production? → Read
    agentos.md
    for AgentOS setup
  4. Integrating external tools? → See
    integration.md
    for MCP and custom tools
  5. Debugging issues? → Enable
    debug_mode=True
    and check logs
  1. 寻找示例? → 先查看
    examples.md
    中的真实场景模式
  2. 需要API细节? → 在
    agents.md
    中搜索类参考和参数
  3. 部署到生产环境? → 阅读
    agentos.md
    了解AgentOS设置
  4. 集成外部工具? → 查看
    integration.md
    中的MCP和自定义工具内容
  5. 调试问题? → 启用
    debug_mode=True
    并查看日志

Common Patterns

常见模式

Pattern: MCP Server Connection Lifecycle

模式:MCP服务器连接生命周期

python
async def run_with_mcp():
    mcp_tools = MCPTools(command="uvx mcp-server-git")
    await mcp_tools.connect()  # Always connect before use

    try:
        agent = Agent(tools=[mcp_tools])
        await agent.aprint_response("Your query")
    finally:
        await mcp_tools.close()  # Always close when done
python
async def run_with_mcp():
    mcp_tools = MCPTools(command="uvx mcp-server-git")
    await mcp_tools.connect()  # Always connect before use

    try:
        agent = Agent(tools=[mcp_tools])
        await agent.aprint_response("Your query")
    finally:
        await mcp_tools.close()  # Always close when done

Pattern: Persistent Sessions with Database

模式:基于数据库的持久化会话

python
from agno.agent import Agent
from agno.db.postgres import PostgresDb

db = PostgresDb(db_url="postgresql://...")

agent = Agent(
    db=db,
    session_id="unique-user-id",
    add_history_to_messages=True,  # Include conversation history
)
python
from agno.agent import Agent
from agno.db.postgres import PostgresDb

db = PostgresDb(db_url="postgresql://...")

agent = Agent(
    db=db,
    session_id="unique-user-id",
    add_history_to_messages=True,  # Include conversation history
)

Pattern: Conditional Workflow Routing

模式:条件工作流路由

python
from agno.workflow.router import Router

workflow = Workflow(
    steps=[
        Router(
            routes={
                "route_a": Step(agent=agent_a),
                "route_b": Step(agent=b),
            }
        )
    ]
)
python
from agno.workflow.router import Router

workflow = Workflow(
    steps=[
        Router(
            routes={
                "route_a": Step(agent=agent_a),
                "route_b": Step(agent=b),
            }
        )
    ]
)

Resources

资源

Official Links

官方链接

Key Concepts to Remember

需牢记的核心概念

  • Always close MCP connections: Use try/finally blocks or async context managers
  • Enable debug mode for troubleshooting:
    debug_mode=True
    shows detailed execution logs
  • Use structured outputs for reliability: Define Pydantic schemas with
    output_schema=
  • Persist sessions with databases: PostgreSQL or SQLite for production agents
  • Disable telemetry if needed: Set
    AGNO_TELEMETRY=false
    or
    telemetry=False
  • 务必关闭MCP连接:使用try/finally块或异步上下文管理器
  • 启用调试模式排查问题
    debug_mode=True
    会显示详细执行日志
  • 使用结构化输出提升可靠性:通过
    output_schema=
    定义Pydantic Schema
  • 使用数据库持久化会话:生产环境Agent推荐使用PostgreSQL或SQLite
  • 按需禁用遥测:设置
    AGNO_TELEMETRY=false
    telemetry=False

scripts/

scripts/

Add helper scripts here for common automation tasks.
在此目录添加常用自动化任务的辅助脚本。

assets/

assets/

Add templates, boilerplate, or example projects here.
在此目录添加模板、样板代码或示例项目。

Notes

说明

  • This skill was automatically generated from official Agno documentation
  • Reference files preserve structure and examples from source docs
  • Code examples include language detection for better syntax highlighting
  • Quick reference patterns are extracted from real-world usage in the docs
  • All examples are tested and production-ready
  • 本Skill由官方Agno文档自动生成
  • 参考文档保留了源文档的结构与示例
  • 代码示例包含语言检测,以实现更好的语法高亮
  • 快速参考模式提取自文档中的真实使用场景
  • 所有示例均经过测试,可投入生产环境使用

Updating

更新

To refresh this skill with updated documentation:
  1. Re-run the scraper with the same configuration
  2. The skill will be rebuilt with the latest information from docs.agno.com
如需使用最新文档刷新本Skill:
  1. 使用相同配置重新运行抓取工具
  2. Skill将基于docs.agno.com的最新信息重建