Build AI agents using AGNO multi-agent team framework for complete market analysis and risk reports

by Brenden Burgess

When you buy through links on our site, we may earn a commission at no extra cost to you. However, this does not influence our evaluations.

In the financial landscape to the rapid rhythm of today, taking advantage of specialized AI agents to manage the discreet aspects of the analysis is essential to provide timely and precise ideas. AgnoThe light and indigenous frame allows developers to quickly run specially designed agents, such as our financial agent for structured market data and the risk assessment agent for volatility and feeling analysis, without complex or complex orchestration code. By defining clear instructions and composing a multi-agent “financial risk team”, AGNO manages coordination, the invocation of the tool and the management of the context behind the scenes, allowing each agent to focus on domain expertise while collaborating transparently to produce a unified report.

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

We install and improve the basic AGNO framework, Google's SDK Genai for the integration of Gemini, the DuckDuckGo's research library to question live information and yfinance for transparent access to the stock market data. By performing it at the start of our colab session, we ensure that all the necessary dependencies are available and up to date to build and manage your funding and risk assessment agents.

from getpass import getpass
import os


os.environ("GOOGLE_API_KEY") = getpass("Enter your Google API key: ")

The above code invites you safely to enter your Google API key in Colab without the echo on the screen, then it is stored in the Google_Pi_Key environment variable. AGNO's Gemini model packaging and the SDK Google Genai can automatically authenticate subsequent API calls by defining this variable.

from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.reasoning import ReasoningTools
from agno.tools.yfinance import YFinanceTools


agent = 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 propelled by the Gemini model (1.5 flash) of Google, equipping them with reasoning capacities and Yfinance tools to recover stock data, analyst recommendations, business information and news, then disseminates a step by step, fully transparent on AAPP, with tracked reasoning and intermediate tool calls, directly at the outlet of colaab.

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 the Gemini model of Google (1.5 Flash): the financial agent recovers and tabule the prices of equity, analyst recommendations, business information and news to provide a concise financial report, while the risk assessment agent analyzes prices and the feeling of news, the feeling of reason for implementation if necessary, to generate focused.

from agno.team.team import Team
from textwrap import dedent


team = 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 are assessing a coordinated “financial risk team” using Agno and Google Gemini. He delegated financial analyzes to the financial agent and volatility / news assessments to the risk assessment agent, then synthesizes their results in a single full report. By calling Team.run on a two -part AAPP task, he 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 ask the financial risk team to execute the AAPP in real time, in difficulty in the internal reasoning of each agent, tool invocations and partial outputs when they occur. By allowing stream_intermediate_steps and show_full_reasoning, we will see exactly how AGNO coordinates the finance and risk assessment agents before delivering the final combined report.

In conclusion, the exploitation of AGNO multi-agent team capacities transforms which would traditionally be a monolithic workflow of AI into a modular and holdable system of experts. Each team agent can specialize in the recovery of financial measures, analysts' feeling of analysts or risk factors assessing. At the same time, the API of the Agno team orchestrates the delegation, the context sharing and the final synthesis. The result is a robust and expandable architecture ranging from simple configurations to two agents to complex sets with minimum code changes and maximum clarity.


Discover the Colab notebook. Also, don't forget to follow us Twitter And join our Telegram And Linkedin Group. Don't forget to join our 90K + ML Subdreddit. For promotion and partnerships, Please talk to us.

🔥 (Register now) Minicon Virtual Conference on AIA: Free registration + presence certificate + 4 hours (May 21, 9 a.m. to 1 p.m. PST) + Practical workshop


Asif Razzaq is the CEO of Marktechpost Media Inc .. as a visionary entrepreneur and engineer, AIF undertakes to exploit the potential of artificial intelligence for social good. His most recent company is the launch of an artificial intelligence media platform, Marktechpost, which stands out from its in-depth coverage of automatic learning and in-depth learning news which are both technically solid and easily understandable by a large audience. The platform has more than 2 million monthly views, illustrating its popularity with the public.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.