本文将向大家介绍Agno——一款用于构建多模态智能体的轻量化框架。其速度号称比LangGraph快上万倍,内存使用量则仅为1/50。
在开发代理式AI时,开发者往往需要在速度、灵活性和资源利用率间反复权衡。本文将向大家介绍Agno——一款用于构建多模态智能体的轻量化框架。其速度号称比LangGraph快上万倍,内存使用量则仅为1/50。
事实上,Agno与LangGraph在使用体验上也有很大区别。本文将以亲身体会为基础对二者进行比较,具体介绍它们的不同之处、各自亮点与Agno的独特优势。
基于性能和极简主义设计而成的Agno,从本质上讲是一款开源且模型中立的智能体框架,专为多模态任务而打造——即可以原生处理文本、图像、音频和视频。它的独特之处在于便捷快速,在应对大量智能体并面对高内存用量、工具和向量存储复杂度时仍保持良好性能。
核心优势:
Agno的使用体验非常高效,启动的智能体队列不仅可以并行运行,还能共享内存、工具和知识库。这些智能体可以专门化并分组为多智能体团队,且内存层支持将会话和状态存储在持久数据库当中。
真正令人印象深刻的,是Agno如何在不牺牲性能的前提下管理复杂性。它可以处理现实世界的智能体编排(如工具链、基于RAG检索或者结构化输出生成),保证不引发性能瓶颈。
如果大家用过LangGraph或者类似框架,就会意识到Agno大大降低了启动延迟与资源消耗。这也成为规模化应用场景下良好性能的实现关键。下面开始构建TriSage智能体。
!pip install -U agno
!pip install duckduckgo-search
!pip install openai
!pip install pycountry
以上为安装必要Python包的shell命令:
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.googlesearch import GoogleSearchTools
from agno.tools.dalle import DalleTools
from agno.team import Team
from textwrap import dedent
from getpass import getpass
OPENAI_KEY = getpass('Enter Open AI API Key: ')
import os
os.environ['OPENAI_API_KEY'] = OPENAI_KEY
web_agent – Searches the Web, writer_agent – Writes the Article, image_agent – Creates Visuals
web_agent = Agent(
name="Web Agent",
role="Search the web for information on Eiffel tower",
model=OpenAIChat(id="o3-mini"),
tools=[DuckDuckGoTools()],
instructions="Give historical information",
show_tool_calls=True,
markdown=True,
)
writer_agent = Agent(
name="Writer Agent",
role="Write comprehensive article on the provided topic",
model=OpenAIChat(id="o3-mini"),
tools=[GoogleSearchTools()],
instructions="Use outlines to write articles",
show_tool_calls=True,
markdown=True,
)
image_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DalleTools()],
description=dedent("""\
You are an experienced AI artist with expertise in various artistic styles,
from photorealism to abstract art. You have a deep understanding of composition,
color theory, and visual storytelling.\
"""),
instructions=dedent("""\
As an AI artist, follow these guidelines:
1. Analyze the user's request carefully to understand the desired style and mood
2. Before generating, enhance the prompt with artistic details like lighting, perspective, and atmosphere
3. Use the `create_image` tool with detailed, well-crafted prompts
4. Provide a brief explanation of the artistic choices made
5. If the request is unclear, ask for clarification about style preferences
Always aim to create visually striking and meaningful images that capture the user's vision!\
"""),
markdown=True,
show_tool_calls=True,
)
agent_team = Agent(
team=[web_agent, writer_agent, image_agent],
model=OpenAIChat(id="gpt-4o"),
instructions=["Give historical information", "Use outlines to write articles","Generate Image"],
show_tool_calls=True,
markdown=True,
)
agent_team.print_response("Write an article on Eiffel towar and generate image", stream=True)
I have created a realistic image of the Eiffel Tower. The image captures the
tower's full height and design, ┃
┃ beautifully highlighted by the late afternoon sun. You can view it by
clicking here.
此智能体是一套使用Agno的团队系统,将通过DuckDuckGo获取实时信息的Web智能体与通过雅虎金融获取数据的金融智能体结合起来。其由OpenAI模型提供支持,使用表格、markdown及来源支持内容提供市场洞察与AI企业绩效,借此保证结果明确、有深度且公开透明。
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="o3-mini"),
tools=[DuckDuckGoTools()],
instructinotallow="Always include sources",
show_tool_calls=True,
markdown=True,
)
finance_agent = Agent(
name="Finance Agent",
role="Get financial data",
model=OpenAIChat(id="o3-mini"),
tools=[YFinanceTools(stock_price=True, analyst_recommendatinotallow=True, company_info=True)],
instructinotallow="Use tables to display data",
show_tool_calls=True,
markdown=True,
)
agent_team = Agent(
team=[web_agent, finance_agent],
model=OpenAIChat(id="gpt-4o"),
instructinotallow=["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 top AI companies of the world?", stream=True)
下面我们来看Agno官方文档中列出的性能细节:
指标 |
Agno |
LangGraph |
差异 |
智能体实例化用时 |
~2μs |
~20ms |
快~1万倍 |
每智能体内存用量 |
~3.75 KiB |
~137 KiB |
仅为~1/50 |
这样的性能优势代表的不只是数字差异,更是可扩展性的新希望。在现实智能体部署中,用户往往需要同时启动成千上万个智能体,因此每毫秒、每KB都很重要。
虽然LangGraph对于某些流应用来说功能强大且结构更加完善,但除非经过深度优化,否则在这类高负载场景下往往性能不佳。
不一定,具体视应用需求而定:
Agno显然更倾向于速度和系统层级的效率,而LangGraph则偏重结构化编排与可靠性。不过Agno开发团队也非常重视准确性与可靠性,而且目前正在为此投入时间和精力。
从实践角度来看,Agno已经为生产级工作负载做好了准备,尤其是对大规模构建智能体系统的团队而言。它的实时性能监控、对结构化输出的支持以及插入内存+向量知识的能力,使其成为能够快速构建强大应用程序的出色平台。
但LangGraph的江湖地位也没有动摇——它的优势在于清晰且面向流程的控制逻辑。不过如果大家遇到了扩展障碍,或者需要运行成千上万个智能体又不致挤爆基础设施,那么Agno无疑更值得考虑。
大模型时代,火爆出圈的LLM大模型让程序员们开始重新评估自己的本领。 “AI会取代那些行业
?”“谁的饭碗又将不保了?
”等问题热议不断。
事实上,抢你饭碗的不是AI,而是会利用AI的人。
继科大讯飞、阿里、华为
等巨头公司发布AI产品后,很多中小企业也陆续进场!超高年薪,挖掘AI大模型人才! 如今大厂老板们,也更倾向于会AI的人,普通程序员,还有应对的机会吗?
不如成为「掌握AI工具的技术人
」,毕竟AI时代,谁先尝试,谁就能占得先机!
但是LLM相关的内容很多,现在网上的老课程老教材关于LLM又太少。所以现在小白入门就只能靠自学,学习成本和门槛很高。
针对所有自学遇到困难的同学们,我帮大家系统梳理大模型学习脉络,将这份 LLM大模型资料
分享出来:包括LLM大模型书籍、640套大模型行业报告、LLM大模型学习视频、LLM大模型学习路线、开源大模型学习教程
等, 有需要的小伙伴,可以 扫描下方二维码领取↓↓↓
AI大模型已经成为了当今科技领域的一大热点,那以下这些大模型书籍就是非常不错的学习资源。
这套包含640份报告的合集,涵盖了大模型的理论研究、技术实现、行业应用等多个方面。无论您是科研人员、工程师,还是对AI大模型感兴趣的爱好者,这套报告合集都将为您提供宝贵的信息和启示。(几乎涵盖所有行业)
目标:了解AI大模型的基本概念、发展历程和核心原理。
内容:
目标:掌握AI大模型API的使用和开发,以及相关的编程技能。
内容:
目标:深入理解AI大模型的应用架构,并能够进行私有化部署。
内容:
目标:掌握多种AI大模型的私有化部署,包括多模态和特定领域模型。
内容:
这份 LLM大模型资料
包括LLM大模型书籍、640套大模型行业报告、LLM大模型学习视频、LLM大模型学习路线、开源大模型学习教程
等, 有需要的小伙伴,可以 扫描下方二维码领取↓↓↓