agno

2025-12-11 0 168

文档|示例| ?明星我们

什么是agno

agno是一个全栈框架,用于构建具有内存,知识和推理的多代理系统。

使用agno构建5个级别的代理系统:

  • 1级:具有工具和说明的代理。
  • 级别2:具有知识和存储的代理。
  • 级别3:具有内存和推理的代理。
  • 第4级:可以推理和协作的代理团队。
  • 第5级:具有状态和决定论的代理工作流程。

示例:使用Yfinance API回答问题的1级推理代理:

agno.agent import Agent
from agno .models.anthropic import Claude
from agno .tools.reasoning import ReasoningTools
from agno .tools.yfinance import YFinanceTools

reasoning_agent = Agent(
model=Claude(id=\”claude-sonnet-4-20250514\”),
tools=[
ReasoningTools(add_instructions=True),
YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True),
],
instructions=\”Use tables to display data.\”,
markdown=True,
)\”>

 from agno . agent import Agent
from agno . models . anthropic import Claude
from agno . tools . reasoning import ReasoningTools
from agno . tools . yfinance import YFinanceTools

reasoning_agent = Agent (
    model = Claude ( id = \"claude-sonnet-4-20250514\" ),
    tools = [
        ReasoningTools ( add_instructions = True ),
        YFinanceTools ( stock_price = True , analyst_recommendations = True , company_info = True , company_news = True ),
    ],
    instructions = \"Use tables to display data.\" ,
    markdown = True ,
)
clunching_finance_agent.mp4

开始

如果您是agno的新手,请阅读文档以构建您的第一个代理,在操场上与它进行聊天,然后在agno .com上进行监视。

之后,结帐示例画廊并使用agno构建真实的应用程序。

为什么要agno ?

agno将帮助您建立一流的,高度表现的代理系统,为您节省数小时的研究和样板。这是一些将agno与众不同的关键功能:

  • Model agno Stic : agno为23+模型提供商提供了一个统一的接口,没有锁定。
  • 高性能剂:代理在〜3μs中进行实例化,平均使用〜6.5KIB记忆。
  • 推理是一流的公民:推理提高了可靠性,对于复杂的自主代理人来说是必不可少的。 agno支持3种推理方法:推理模型,推理工具或我们的定制链条方法。
  • 本地多模式: agno代理是本地多模式的,他们接受文本,图像,音频和视频作为输入,并生成文本,图像,音频和视频作为输出。
  • 高级多代理体系结构: agno为行业领先的多代理体系结构(代理团队)提供了推理,内存和共享上下文。
  • 内置代理搜索:代理可以使用20+矢量数据库在运行时搜索信息。 agno提供了最先进的代理抹布,完全异步和高性能。
  • 内置内存和会话存储:代理带有内置存储和内存驱动程序,可为您的代理提供长期内存和会话存储。
  • 结构化输出: agno代理可以使用模型提供的结构化输出或JSON_MODE返回完全类型的响应。
  • 预先建造的FastApi路线:建造代理后,使用预先构建的FastApi路线为其服务。 0在几分钟内生产。
  • 监视:在agno .com上实时实时的监视代理会话和性能。

安装

pip install -U agno 

示例 – 推理代理

让我们建立一个推理代理,以了解agno的能力。

将此代码保存到文件:clunching_agent.py。

agno.agent import Agent
from agno .models.anthropic import Claude
from agno .tools.reasoning import ReasoningTools
from agno .tools.yfinance import YFinanceTools

agent = Agent(
model=Claude(id=\”claude-sonnet-4-20250514\”),
tools=[
ReasoningTools(add_instructions=True),
YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True),
],
instructions=[
\”Use tables to display data\”,
\”Only output the report, no other text\”,
],
markdown=True,
)
agent.print_response(
\”Write a report on NVDA\”,
stream=True,
show_full_reasoning=True,
stream_intermediate_steps=True,
)\”>

 from agno . agent import Agent
from agno . models . anthropic import Claude
from agno . tools . reasoning import ReasoningTools
from agno . tools . yfinance import YFinanceTools

agent = Agent (
    model = Claude ( id = \"claude-sonnet-4-20250514\" ),
    tools = [
        ReasoningTools ( add_instructions = True ),
        YFinanceTools ( stock_price = True , analyst_recommendations = True , company_info = True , company_news = True ),
    ],
    instructions = [
        \"Use tables to display data\" ,
        \"Only output the report, no other text\" ,
    ],
    markdown = True ,
)
agent . print_response (
    \"Write a report on NVDA\" ,
    stream = True ,
    show_full_reasoning = True ,
    stream_intermediate_steps = True ,
)

然后创建一个虚拟环境,安装依赖项,导出您的Anthropic_api_key并运行代理。

agno anthropic yfinance

export ANTHROPIC_API_KEY=sk-ant-api03-xxxx

python reasoning_agent.py\”>

uv venv --python 3.12
source .venv/bin/activate

uv pip install agno anthropic yfinance

export ANTHROPIC_API_KEY=sk-ant-api03-xxxx

python reasoning_agent.py

我们可以看到代理通过任务推理,使用推理工具和yfinancetools收集信息。这就是输出的样子:

clunching_finance_agent.mp4

示例 – 多代理团队

代理人是原子能部门,当它们具有狭窄的范围和少量工具时,它们的运作效果最好。当工具的数量超出模型可以处理的内容或您需要处理多个概念的数量时,请使用代理团队来分散负载。

agno.agent import Agent
from agno .models.openai import OpenAIChat
from agno .tools.duckduckgo import DuckDuckGoTools
from agno .tools.yfinance import YFinanceTools
from agno .team import Team

web_agent = Agent(
name=\”Web Agent\”,
role=\”Search the web for information\”,
model=OpenAIChat(id=\”gpt-4o\”),
tools=[DuckDuckGoTools()],
instructions=\”Always include sources\”,
show_tool_calls=True,
markdown=True,
)

finance_agent = Agent(
name=\”Finance Agent\”,
role=\”Get financial data\”,
model=OpenAIChat(id=\”gpt-4o\”),
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
instructions=\”Use tables to display data\”,
show_tool_calls=True,
markdown=True,
)

agent_team = Team(
mode=\”coordinate\”,
members=[web_agent, finance_agent],
model=OpenAIChat(id=\”gpt-4o\”),
success_criteria=\”A comprehensive financial news report with clear sections and data-driven insights.\”,
instructions=[\”Always include sources\”, \”Use tables to display data\”],
show_tool_calls=True,
markdown=True,
)

agent_team.print_response(\”What\’s the market outlook and financial performance of AI semiconductor companies?\”, stream=True)\”>

 from agno . agent import Agent
from agno . models . openai import OpenAIChat
from agno . tools . duckduckgo import DuckDuckGoTools
from agno . tools . yfinance import YFinanceTools
from agno . team import Team

web_agent = Agent (
    name = \"Web Agent\" ,
    role = \"Search the web for information\" ,
    model = OpenAIChat ( id = \"gpt-4o\" ),
    tools = [ DuckDuckGoTools ()],
    instructions = \"Always include sources\" ,
    show_tool_calls = True ,
    markdown = True ,
)

finance_agent = Agent (
    name = \"Finance Agent\" ,
    role = \"Get financial data\" ,
    model = OpenAIChat ( id = \"gpt-4o\" ),
    tools = [ YFinanceTools ( stock_price = True , analyst_recommendations = True , company_info = True )],
    instructions = \"Use tables to display data\" ,
    show_tool_calls = True ,
    markdown = True ,
)

agent_team = Team (
    mode = \"coordinate\" ,
    members = [ web_agent , finance_agent ],
    model = OpenAIChat ( id = \"gpt-4o\" ),
    success_criteria = \"A comprehensive financial news report with clear sections and data-driven insights.\" ,
    instructions = [ \"Always include sources\" , \"Use tables to display data\" ],
    show_tool_calls = True ,
    markdown = True ,
)

agent_team . print_response ( \"What\'s the market outlook and financial performance of AI semiconductor companies?\" , stream = True )

安装依赖项并运行代理团队:

pip install duckduckgo-search yfinance

python agent_team.py

在食谱中查看此示例

表现

在agno ,我们迷上了表现。为什么?因为即使是简单的AI工作流也可以产生数千个代理。将其扩展到适度的用户,性能成为瓶颈。 agno专为建造高性能代理系统而设计:

  • 代理实例:平均约3μs
  • 内存足迹:平均〜6.5KIB

在Apple M4 Mackbook Pro上测试。

虽然通过推理对代理的运行时间进行瓶颈,但我们必须尽一切可能最小化执行时间,减少内存使用情况并并行化工具调用。这些数字起初似乎很容易,但是我们的经验表明它们甚至在相当小的规模上加起来。

实例化时间

让我们衡量具有1个工具启动的代理所花费的时间。我们将进行评估1000次以获得基线测量。

您应该自己在自己的机器上进行评估,请不要以面值来获得这些结果。

agno langgraph langchain_openai

# agno
python evals/performance/instantiation_with_tool.py

# LangGraph
python evals/performance/other/langgraph_instantiation.py\”>

 # Setup virtual environment
./scripts/perf_setup.sh
source .venvs/perfenv/bin/activate
# OR Install dependencies manually
# pip install openai agno langgraph langchain_openai

# agno
python evals/performance/instantiation_with_tool.py

# LangGraph
python evals/performance/other/langgraph_instantiation.py

以下评估在Apple M4 Mackbook Pro上进行。它还可以作为该仓库的github动作运行。

langgraph在右边,让我们先启动它,然后让它开始

agno在左边,请注意在Langgraph通过运行时测量1/2之前的结束,甚至没有开始记忆测量。这就是agno速度。

内存使用

为了测量内存使用情况,我们使用Tracemalloc库。我们首先通过运行空功能来计算基线内存使用量,然后运行代理1000倍并计算差异。这给出了对代理的内存使用情况的(合理)孤立的测量。

我们建议您自己在自己的机器上运行评估,然后挖掘代码以查看其工作原理。如果我们犯了一个错误,请告诉我们。

结论

agno代理是为性能而设计的,尽管我们确实针对其他框架共享一些基准,但我们应该注意准确性和可靠性比速度更重要。

鉴于每个框架都是不同的,我们将无法像与agno那样调整其性能,因为将来的基准标准我们只会与自己进行比较。

完整的文档索引

为了使LLMS和AI助手了解和导航agno的完整文档,我们提供了llms.txt或llms-full.txt文件。

该文件专门为AI系统有效解析和引用我们的文档。

光标设置

在构建agno代理时,将agno文档作为光标中的来源是加快开发的好方法。

  1. 在光标中,转到“光标设置”菜单。
  2. 找到“索引和文档”部分。
  3. 将https://docs.*a**gno.com/llms-full.txt添加到文档URL列表中。
  4. 保存更改。

现在,光标将可以访问agno文档。

文档,社区和更多示例

  • 文档:文档。 agno .com
  • 食谱:食谱
  • 社区论坛:社区。 agno .com
  • 不和谐:不和谐

贡献

我们欢迎贡献,阅读我们的贡献指南以入门。

遥测

代理使用的agno日志,以便我们将更新优先为最受欢迎的提供商。您可以通过在环境中设置agno _telemetry = false来禁用此问题。

⬆️回到顶部

下载源码

通过命令行克隆项目:

git clone https://github.com/agno-agi/agno.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 编程相关 agno https://www.zuozi.net/33919.html

MegaLeak
上一篇: MegaLeak
neutralinojs
下一篇: neutralinojs
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务