MarkTechPost@AI 05月05日 04:30
Building AI Agents Using Agno’s Multi-Agent Teaming Framework for Comprehensive Market Analysis and Risk Reporting
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了Agno框架,一个用于构建AI多智能体的工具,特别适用于金融领域的市场分析和风险报告。Agno框架通过简化流程,使开发者能够快速构建专门的智能体,例如处理结构化市场数据的Finance Agent和进行波动性与情绪分析的Risk Assessment Agent。文章详细阐述了如何使用Agno框架,包括安装依赖、配置API密钥、创建Agent,以及如何将这些Agent组成一个团队来协作完成复杂的任务。通过示例代码,展示了Agno框架在处理金融数据分析和风险评估方面的强大功能,并强调了其模块化、可维护的特性。

💡 Agno框架是一个轻量级、模型无关的工具,旨在帮助开发者快速构建AI智能体,而无需编写繁琐的模板代码或复杂的编排代码。

📈 通过Agno框架,可以创建专门的智能体,例如Finance Agent和Risk Assessment Agent,前者处理结构化市场数据,后者进行波动性和情绪分析,从而实现更精准的金融分析。

🤝 Agno框架支持多智能体协作,开发者可以将多个智能体组合成一个团队,例如Finance-Risk Team,协同完成复杂的任务,提高效率和准确性。

⚙️ Agno框架简化了智能体的协调、工具调用和上下文管理,使得每个智能体专注于其专业领域,并无缝协作以生成统一的报告。

💻 文章提供了详细的示例代码,展示了如何使用Agno框架进行金融数据分析和风险评估,包括安装依赖、配置API密钥、创建Agent和组建团队。

In today’s fast-paced financial landscape, leveraging specialized AI agents to handle discrete aspects of analysis is key to delivering timely, accurate insights. Agno’s lightweight, model-agnostic framework empowers developers to rapidly spin up purpose-built agents, such as our Finance Agent for structured market data and Risk Assessment Agent for volatility and sentiment analysis, without boilerplate or complex orchestration code. By defining clear instructions and composing a multi-agent “Finance-Risk Team,” Agno handles the coordination, tool invocation, and context management behind the scenes, enabling each agent to focus on its domain expertise while seamlessly collaborating to produce a unified report.

!pip install -U agno google-genai duckduckgo-search yfinance

We install and upgrade the core Agno framework, Google’s GenAI SDK for Gemini integration, the DuckDuckGo search library for querying live information, and YFinance for seamless access to stock market data. By running it at the start of our Colab session, we ensure all necessary dependencies are available and up to date for building and running your finance and risk assessment agents.

from getpass import getpassimport osos.environ["GOOGLE_API_KEY"] = getpass("Enter your Google API key: ")

The above code securely prompts you to enter your Google API key in Colab without echoing it to the screen, and then it is stored in the GOOGLE_API_KEY environment variable. Agno’s Gemini model wrapper and the Google GenAI SDK can automatically authenticate subsequent API calls by setting this variable.

from agno.agent import Agentfrom agno.models.google import Geminifrom agno.tools.reasoning import ReasoningToolsfrom agno.tools.yfinance import YFinanceToolsagent = Agent(    model=Gemini(id="gemini-1.5-flash"),      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 AAPL",    stream=True,    show_full_reasoning=True,    stream_intermediate_steps=True)

We initialize an Agno agent powered by Google’s Gemini (1.5 Flash) model, equip it with reasoning capabilities and YFinance tools to fetch stock data, analyst recommendations, company information, and news, and then stream a step-by-step, fully transparent report on AAPL, complete with chained reasoning and intermediate tool calls, directly to the Colab output.

finance_agent = Agent(    name="Finance Agent",    model=Gemini(id="gemini-1.5-flash"),    tools=[        YFinanceTools(            stock_price=True,            analyst_recommendations=True,            company_info=True,            company_news=True        )    ],    instructions=[        "Use tables to display stock price, analyst recommendations, and company info.",        "Only output the financial report without additional commentary."    ],    markdown=True)risk_agent = Agent(    name="Risk Assessment Agent",    model=Gemini(id="gemini-1.5-flash"),    tools=[        YFinanceTools(            stock_price=True,            company_news=True        ),        ReasoningTools(add_instructions=True)    ],    instructions=[        "Analyze recent price volatility and news sentiment to provide a risk assessment.",        "Use tables where appropriate and only output the risk assessment section."    ],    markdown=True)

These definitions create two specialized Agno agents using Google’s Gemini (1.5 Flash) model: the Finance Agent fetches and tabulates stock prices, analyst recommendations, company info, and news to deliver a concise financial report, while the Risk Assessment Agent analyzes price volatility and news sentiment, leveraging reasoning tools where needed, to generate a focused risk assessment section.

from agno.team.team import Teamfrom textwrap import dedentteam = Team(    name="Finance-Risk Team",    mode="coordinate",    model=Gemini(id="gemini-1.5-flash"),    members=[finance_agent, risk_agent],    tools=[ReasoningTools(add_instructions=True)],    instructions=[        "Delegate financial analysis requests to the Finance Agent.",        "Delegate risk assessment requests to the Risk Assessment Agent.",        "Combine their outputs into one comprehensive report."    ],    markdown=True,    show_members_responses=True,    enable_agentic_context=True)task = dedent("""1. Provide a financial overview of AAPL.2. Provide a risk assessment for AAPL based on volatility and recent news.""")response = team.run(task)print(response.content)

We assemble a coordinated “Finance-Risk Team” using Agno and Google Gemini. It delegates financial analyses to the Finance Agent and volatility/news assessments to the Risk Assessment Agent, then synthesizes their outputs into a single, comprehensive report. By calling team.run on a two-part AAPL task, it transparently orchestrates each expert agent and prints the unified result.

team.print_response(    task,    stream=True,    stream_intermediate_steps=True,    show_full_reasoning=True)

We instruct the Finance-Risk Team to execute the AAPL task in real time, streaming each agent’s internal reasoning, tool invocations, and partial outputs as they happen. By enabling stream_intermediate_steps and show_full_reasoning, we’ll see exactly how Agno coordinates the Finance and Risk Assessment Agents step-by-step before delivering the final, combined report.

In conclusion, harnessing Agno’s multi-agent teaming capabilities transforms what would traditionally be a monolithic AI workflow into a modular, maintainable system of experts. Each agent in the team can specialize in fetching financial metrics, parsing analyst sentiment, or evaluating risk factors. At the same time, Agno’s Team API orchestrates delegation, context-sharing, and final synthesis. The result is a robust, extensible architecture ranging from simple two-agent setups to complex ensembles with minimal code changes and maximal clarity.


Check out the Colab Notebook. Also, don’t forget to follow us on Twitter and join our Telegram Channel and LinkedIn Group. Don’t Forget to join our 90k+ ML SubReddit. For Promotion and Partnerships, please talk us.

[Register Now] miniCON Virtual Conference on AGENTIC AI: FREE REGISTRATION + Certificate of Attendance + 4 Hour Short Event (May 21, 9 am- 1 pm PST) + Hands on Workshop

The post Building AI Agents Using Agno’s Multi-Agent Teaming Framework for Comprehensive Market Analysis and Risk Reporting appeared first on MarkTechPost.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Agno框架 AI智能体 金融分析 风险评估 多智能体协作
相关文章