Building a Reasoning Finance Team with Agno
Build a multi-agent financial analysis team with LangDB and Agno.
This guide demonstrates how to construct a sophisticated, multi-agent financial analysis team using LangDB. The team collaborates to deliver in-depth insights on publicly traded companies by combining web research and financial data analysis.
Code
Overview
The system is composed of two specialist agents orchestrated by a coordinating team:
Web Search Agent: Responsible for gathering the latest news and market sentiment from the internet.
Finance Agent: Equipped with YFinanceTools to fetch and analyze quantitative stock data, including pricing, fundamentals, and analyst recommendations.
Reasoning Finance Team: A coordinator that directs the two agents, synthesizes their findings, and produces a final, comprehensive report.
LangDB provides the backbone for this system, enabling seamless model access, tool integration, and full observability into each agent's actions and the team's collaborative process.
Installation
Environment Variables
Create a .env file or export the following environment variables:
Code Walkthrough
Initialize LangDB
Start by initializing LangDB to enable automatic tracing and model routing. This should be done before importing any other components from the agno library.
Define the Web Search Agent
The web_agent is responsible for searching the web. Instead of hard-coding a search tool, we assign it a LangDB Virtual Model. This decouples the agent's logic from the specific tools it uses. The virtual model is configured in the LangDB UI to provide search capabilities, as explained in the configuration section below.
Define the Finance Agent
This agent is equipped with YFinanceTools to access a wide range of financial data. It is powered by Grok-4 and has specific instructions to format its output professionally.
Define the Coordinating Team
The ReasoningFinanceTeam orchestrates the two agents. It operates in coordinate mode, allowing it to delegate tasks, synthesize information, and ensure the final output meets the specified success criteria.
Configuring Virtual Models and Tools
To empower the web_agent with live web search capabilities without hard-coding tools, we configure a Virtual Model in LangDB. This model is backed by a Virtual MCP Server that provides the actual search functionality.
Create a Virtual MCP Server
First, create a dedicated MCP server for the search tool.
In the LangDB UI, navigate to Projects → MCP Servers.
Click + New Virtual MCP Server and configure it:
Name:
web-search-mcpUnderlying MCP: Select Tavily Search.
Note: The Tavily MCP requires an API key. Ensure you have added your
TAVILY_API_KEYto your LangDB account secrets for the tool to function.
Create and Configure the Virtual Model
Next, create a virtual model and attach the MCP you just made.
Navigate to Models → + New Virtual Model.
Give it a name (e.g.,
search-agent).In the Tools section, click + Attach MCP Server and select the
web-search-mcpyou created.Save the model and copy its identifier (e.g.,
langdb/search-agent_xxxxxx).Use this identifier as the
modelin yourweb_agentdefinition.
Running the Team
To run the team, simply call the print_response method with a detailed prompt. The team will autonomously delegate tasks to the appropriate agents and generate a consolidated response.
Full Trace
Every execution is captured in LangDB, providing a complete trace of the agno team's operations. This includes the initial prompt, each agent's individual contributions, the tools they used, and the final synthesized output.
Checkout: https://app.langdb.ai/sharing/threads/73c91c58-eab7-4c6b-afe1-5ab6324f1ada for full conversation

References
Last updated
Was this helpful?
