成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Agno框架介紹:用于構建多模態智能體的輕量庫

譯文 精選
人工智能
本文將向大家介紹Agno——一款用于構建多模態智能體的輕量化框架。其速度號稱比LangGraph快上萬倍,內存使用量則僅為1/50。

譯者 | 核子可樂

審校 | 重樓

在開發代理式AI時,開發者往往需要在速度、靈活性和資源利用率間反復權衡。本文將向大家介紹Agno——一款用于構建多模態智能體的輕量化框架。其速度號稱比LangGraph快上萬倍,內存使用量則僅為1/50。

事實上,Agno與LangGraph在使用體驗上也有很大區別。本文將以親身體會為基礎對二者進行比較,具體介紹它們的不同之處、各自亮點與Agno的獨特優勢。

概述

  • 構建TriSage與Marketing Analyst營銷分析師智能體。
  • 如果要求高速、低內存占用、多模態功能以及靈活的模型/工具選項,請選擇Agno。
  • 如果偏向基于流程的邏輯或結構化執行路徑,或者已經與LangChain生態系統緊密關聯,請選擇LangGraph。

Agno有何作用?

基于性能和極簡主義設計而成的Agno,從本質上講是一款開源且模型中立的智能體框架,專為多模態任務而打造——即可以原生處理文本、圖像、音頻和視頻。它的獨特之處在于便捷快速,在應對大量智能體并面對高內存用量、工具和向量存儲復雜度時仍保持良好性能。

核心優勢:

  • 超快的實例化速度:Agno中的智能體創建速度平均僅為2微秒,約為LangGraph的1萬倍。
  • 輕量化內存占用:Agno智能體平均內存占用量為3.75 KiB,僅相當于LangGraph智能體的1/50。
  • 原生支持多模態:無需調整或插件,Agno可直接與各種媒體類型實現無縫協作。
  • 模型中立:Agno不關心用戶使用的是OpenAI、Claude、Gemini抑或是開源大模型,因此避免了特定供應商或運行時鎖定的問題。
  • 實時監控:可以通過Agno實時觀察智能體會話及性能,使得調試和優化更加流暢。

Agno上手實踐:構建TriSage智能體

Agno的使用體驗非常高效,啟動的智能體隊列不僅可以并行運行,還能共享內存、工具和知識庫。這些智能體可以專門化并分組為多智能體團隊,且內存層支持將會話和狀態存儲在持久數據庫當中。

真正令人印象深刻的,是Agno如何在不犧牲性能的前提下管理復雜性。它可以處理現實世界的智能體編排(如工具鏈、基于RAG檢索或者結構化輸出生成),保證不引發性能瓶頸。

如果大家用過LangGraph或者類似框架,就會意識到Agno大大降低了啟動延遲與資源消耗。這也成為規模化應用場景下良好性能的實現關鍵。下面開始構建TriSage智能體。

安裝必要庫

!pip install -U agno
!pip install duckduckgo-search
!pip install openai
!pip install pycountry

以上為安裝必要Python包的shell命令:

  • agno: 用于定義和運行AI智能體的核心框架。
  • duckduckgo-search: 讓智能體使用DuckDuckGo搜索網絡。
  • openai: 用于同OpenAI模型(如GPT-4或GPT-3.5)交互。

必要導入

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

API密鑰設置

from getpass import getpass
OPENAI_KEY = getpass('Enter Open AI API Key: ')

import os
os.environ['OPENAI_API_KEY'] = OPENAI_KEY
  • getpass(): 輸入API密鑰的安全方式(不可見)。
  • 將密鑰存儲在環境內,以便agno框架在調用OpenAI API時進行獲取。

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:構建營銷分析師智能體

此智能體是一套使用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與LangGraph:性能對決

下面我們來看Agno官方文檔中列出的性能細節:

指標

Agno

LangGraph

差異

智能體實例化用時

~2μs

~20ms

快~1萬倍

每智能體內存用量

~3.75 KiB

~137 KiB

僅為~1/50

  • 此性能測試采用Python版tracemalloc內存分析,硬件平臺為蘋果M4 MacBook Pro筆記本電腦。
  • Agno測量了1000次運行的平均實例化用時及內存用量,隔離了智能體代碼以保證結果準確。

這樣的性能優勢代表的不只是數字差異,更是可擴展性的新希望。在現實智能體部署中,用戶往往需要同時啟動成千上萬個智能體,因此每毫秒、每KB都很重要。

雖然LangGraph對于某些流應用來說功能強大且結構更加完善,但除非經過深度優化,否則在這類高負載場景下往往性能不佳。

所以說……Agno比LangGraph更好?

不一定,具體視應用需求而定:

  • 如果處理基于流傳輸的智能體邏輯(例如具有高級控制的分步有向圖),則LangGraph可能會提供更具表現力的結構。
  • 如果需要超快、低內存的多模態智能體執行效果,而且環境的并發或動態程度較高,那么Agno將會遙遙領先。

Agno顯然更傾向于速度和系統層級的效率,而LangGraph則偏重結構化編排與可靠性。不過Agno開發團隊也非常重視準確性與可靠性,而且目前正在為此投入時間和精力。

總結

從實踐角度來看,Agno已經為生產級工作負載做好了準備,尤其是對大規模構建智能體系統的團隊而言。它的實時性能監控、對結構化輸出的支持以及插入內存+向量知識的能力,使其成為能夠快速構建強大應用程序的出色平臺。

但LangGraph的江湖地位也沒有動搖——它的優勢在于清晰且面向流程的控制邏輯。不過如果大家遇到了擴展障礙,或者需要運行成千上萬個智能體又不致擠爆基礎設施,那么Agno無疑更值得考慮。

原文標題:Agno Framework: A Lightweight Library for Building Multimodal Agents作者:Pankaj Singh

責任編輯:姜華 來源: 51CTO內容精選
相關推薦

2025-05-26 09:49:59

多模態智能體RAG

2025-04-07 02:00:00

2024-10-15 17:28:05

2023-12-30 08:12:42

2023-07-28 15:32:26

鴻蒙操作系統

2024-01-08 08:23:08

OpenCV機器學習計算機視覺

2024-02-20 09:42:36

自動駕駛預測

2023-08-07 15:13:09

設備開發鴻蒙

2025-04-25 02:30:00

機械臂大模型多模態

2025-04-29 08:00:00

Rowboat多智能體人工智能

2023-07-30 16:05:44

多模態學習框架自然語言

2023-04-25 11:31:33

智能AI

2025-06-17 06:28:08

2025-06-26 09:01:14

2025-02-25 07:49:36

智能體數據庫DeepSeek

2024-01-11 16:24:12

人工智能RAG

2024-03-25 00:30:00

AI框架

2025-03-04 09:10:00

模型自動化智能體
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 又黑又粗又长的欧美一区 | 亚洲综合大片69999 | 国产精品亚洲一区二区三区在线观看 | 久久中文字幕一区 | 精品成人69xx.xyz | 美女久久久久久久 | 国产成人精品在线 | 国产精品毛片无码 | 精品免费国产视频 | 国产欧美精品区一区二区三区 | 日本人和亚洲人zjzjhd | 作爱视频免费观看 | 精品一区二区不卡 | 亚洲精品一区中文字幕乱码 | 久久成人精品视频 | 97超碰在线播放 | 久久精品国产99国产精品 | 日本黄色大片免费 | 久久久久久国产精品 | 欧美日本韩国一区二区 | www.99热这里只有精品 | 福利久久| 亚洲精品国产第一综合99久久 | 一区二区在线视频 | 亚洲一二三区精品 | 欧美小视频在线观看 | 四虎在线观看 | 国产精品一区二区欧美 | 在线色网 | 亚洲一页| 毛片视频观看 | 久久久久久91香蕉国产 | 国产高清在线视频 | 老司机狠狠爱 | 国产欧美一区二区三区在线看 | 交专区videossex农村 | 日韩无| 久亚州在线播放 | 蜜臀网站 | 久久久精品亚洲 | 中文字幕成人 |