
























agno agent 的开发与其他框架没太多区别,以下简单说明下
包含功能工具的
def get_tools(run_context: RunContext):
role = (run_context.session_state or {}).get("role", "general")
if role == "finance":
return [YFinanceTools()]
return [DuckDuckGoTools()]
agent = Agent(
model=OpenAIResponses(id="gpt-5-mini"),
tools=get_tools,
)
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
skills=Skills(loaders=[LocalSkills("/path/to/skills")]),
instructions=[
"You have access to specialized skills.",
"Use get_skill_instructions to load full guidance when needed.",
],
)
新出的模式
from agno.workflow import WorkflowAgent
from agno.workflow.workflow import Workflow
from agno.models.openai import OpenAIResponses
workflow_agent = WorkflowAgent(
model=OpenAIResponses(id="gpt-5.2"), # Set the model that should be used
num_history_runs=4 # How many of the previous runs should it take into account
)
workflow = Workflow(
name="Story Generation Workflow",
description="A workflow that generates stories, formats them, and adds references",
agent=workflow_agent,
)
knowledge = Knowledge(
vector_db=ChromaDb(
collection="docs",
path="tmp/chromadb",
persistent_client=True,
search_type=SearchType.hybrid,
embedder=GeminiEmbedder(id="gemini-embedding-001"),
),
)
# Load content into the knowledge base
knowledge.insert(url="https://docs.agno.com/introduction.md", skip_if_exists=True)
# Create an agent that searches the knowledge base
agent = Agent(
model=Gemini(id="gemini-3-flash-preview"),
knowledge=knowledge,
search_knowledge=True,
markdown=True,
)
db = PostgresDb(
db_url=db_url,
memory_table="user_memories", # Optionally specify a table name for the memories
)
# Initialize Agent
memory_agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
db=db,
# Give the Agent the ability to update memories
enable_agentic_memory=True,
# OR - Run the MemoryManager automatically after each response
update_memory_on_run=True,
markdown=True,
)
airbnb_tools = MCPTools(command="npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
google_maps_tools = MCPTools(command="npx -y @modelcontextprotocol/server-google-maps", env=env)
await airbnb_tools.connect()
await google_maps_tools.connect()
try:
agent = Agent(
tools=[airbnb_tools, google_maps_tools],
markdown=True,
)
await agent.aprint_response(message, stream=True)
finally:
await airbnb_tools.close()
await google_maps_tools.close()
以上是关于简单模式的说明,后续说明下啊team 模式的
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。