ai-hedge-fundCore ConceptsMulti‑Agent Decision Model

Multi-Agent Decision Model: How AI Teams Make Decisions Step-by-Step

This section clearly explains how the AI Hedge Fund platform utilizes multiple specialized AI components, referred to as “agents,” to collaborate and form investment decisions. This approach simulates how a team of human experts within an investment firm might work together to analyze market information and ultimately devise an investment strategy. Our goal is to enable even non-technical readers to grasp the underlying logic and operational mechanics of this AI-driven decision-making process.

Project Core: AI Collaboration and Shared Memory

The fundamental strength of the AI Hedge Fund platform lies in its collaborative team of AI agents, rather than relying on a single AI for all judgments. Each agent acts as a specialized “expert,” responsible for processing specific information or performing particular analyses. These agents do not work in isolation; they communicate and update information through a shared “memory space.” In our AI system, this shared “memory space” is implemented via a special data structure called AgentState.

Imagine a conference room where each agent is an expert. When one expert speaks and presents their insights, these insights are recorded on a shared whiteboard (AgentState), allowing other experts to see them and build upon them for their own analyses. AgentState functions as this AI team’s shared “whiteboard.”

AgentState: The AI Team’s Shared “Whiteboard” and Its Contents

Technically, AgentState is a Python dictionary structure that holds all the critical information generated by various agents throughout the investment decision process. It primarily contains three parts:

  • data (Core Information): This is a dictionary storing all structured analysis results, market data, investment signals, and other key outputs produced by the agents. When new information is generated, it updates the data section. For instance, after a “Warren Buffett” agent completes its analysis, its investment recommendations are written here for subsequent agents to read.
  • messages (Communication Log): Records the raw messages or logs exchanged between agents, helping to trace each “conversation” in the decision process.
  • metadata (Auxiliary Information): Stores additional relevant information about the decision process, such as execution timestamps or request IDs.

Through this AgentState shared “whiteboard,” each agent can access the latest collective analysis progress and contribute its specialized insights, ensuring all decisions are based on the most current and comprehensive information.

Composition of the Multi-Agent Team

The AI system’s team is composed of two main types of specialized experts:

  • Investor-Inspired Agents: These are AI experts designed to “think” and evaluate companies following the philosophies of famous investors (like a “Warren Buffett” AI).
  • Functional Agents: These are AI experts focused on objective tasks, such as reading market sentiment, managing risk, or combining all advice into a final decision.

(To understand each specific AI agent’s detailed responsibilities and how they work, please refer to the “AI Agents Explained” document.)

LangGraph Framework: How the AI Team Collaborates

This section explains how the LangGraph framework organizes and manages the different AI agents, ensuring they work together effectively to make investment decisions.

How Agents Work Together: Your Design and Core Rules

The AI agents collaborate based on two main factors: your visual strategy design and essential system rules.

  • Your Visual Strategy Design:

    • Using the Visual Strategy Builder, you connect agents with lines to create a flowchart. This flowchart defines the sequence in which agents should act and how information should flow between them.
    • LangGraph takes your visual plan and directly builds the step-by-step process that the AI team will follow. You are directly designing the AI’s workflow.
  • System’s Core Rules: Built-in Risk Management:

    • A critical system rule is that risk management is always active. Even if you don’t connect the “Risk Manager” agent in your visual flowchart, LangGraph will automatically ensure its analysis happens right before the “Portfolio Manager” makes a final decision.
    • This built-in rule means that risk limits are always applied. Regardless of your strategy, fundamental risk control is enforced before any trading recommendations are made, making your AI strategies safer.

LangGraph’s Role: Orchestrating the Decision Process

LangGraph plays several key roles in enabling this collaboration:

  • Building the Workflow: It translates your visual flowchart into the actual sequence of steps the agents will take.
  • Managing Shared Information: LangGraph handles the AgentState, which is the central place where all agents share and update their findings. This ensures agents always have the latest information.
  • Allowing Feedback and Adjustments: Agents can interact in multiple rounds. One agent’s output immediately becomes the next agent’s input, creating a loop that allows the AI to refine its decisions. You can easily change your strategy by adding or removing agents and testing new ideas.

Through this organized collaboration, where your design meets crucial system rules, the AI Hedge Fund platform creates transparent and controlled investment decisions. It shows you exactly how the AI team analyzes, judges, and forms investment recommendations step-by-step.

Overall Operation: How Your AI Team Makes Decisions Step-by-Step

Here’s how the entire AI team works together, from start to finish:

  1. Initial Information Gathering: The process begins with basic market data and company details being added to the shared “whiteboard” (AgentState).
  2. Expert Analysis and Information Buildup: Based on your designed flow, various agents (both Investor-Inspired and Functional) take turns. Each agent reads the latest information from the AgentState, performs its specialized analysis, and then writes its findings (like investment signals or risk assessments) back onto the AgentState.
  3. Mandatory Risk Review: As the process moves closer to a final decision, the Risk Manager agent automatically steps in. It evaluates the current situation and sets strict, unbreakable risk limits. This happens before any final trading decision can be made.
  4. Final Decision: The Portfolio Manager agent then combines all the accumulated information and strictly adheres to the Risk Manager’s limits. It synthesizes all the advice from other agents to issue the final simulated trading recommendations.

Through this organized collaboration, where your design meets crucial system rules, the AI Hedge Fund platform creates transparent and controlled investment decisions. It shows you exactly how the AI team analyzes, judges, and forms investment recommendations step-by-step.

Feature/ResponsibilityCode FilePurpose and Implementation Details
Agent State Definitionsrc/graph/state.pyDefines the AgentState TypedDict, which acts as the shared memory for all agents, containing messages, data, and metadata fields for information exchange.
LangGraph Orchestrationapp/backend/services/graph.pyContains the create_graph function that dynamically builds the LangGraph state machine from user-defined nodes and edges, including the logic for mandatory insertion of the risk_management_agent.
LLM Interaction Utilitysrc/utils/llm.pyProvides the call_llm function, which handles sending prompts to the Large Language Model and parsing its structured outputs based on Pydantic models.
Financial Data Toolssrc/tools/api.pyContains functions (e.g., get_financial_metrics, search_line_items, get_market_cap, get_insider_trades, get_company_news, get_prices) which are used by various agents to fetch real-time and historical financial data from external APIs.