What Models Are Used by the Different Agents in AutoHedge?

AutoHedge configures five autonomous trading agents built on the swarms.Agent class, assigning gpt-4o-mini to the Sentiment-Agent and gpt-4.1 to the Risk-Manager, Execution-Agent, Quant-Analyst, and Trading-Director as explicitly defined in autohedge/workers.py.

The-Swarm-Corporation/AutoHedge implements a multi-agent architecture where each specialized component handles a distinct phase of the trading workflow. Understanding what models are used by the different agents in AutoHedge is essential for optimizing API costs, latency, and reasoning capabilities across sentiment analysis, risk management, and trade execution tasks.

Agent Architecture and Model Assignments

All agents inherit from the base swarms.Agent class and are instantiated with explicit model_name parameters that dictate which underlying large language model processes their specific domain. The system separates concerns across five distinct roles, selecting models based on task complexity and computational requirements.

Sentiment-Agent (gpt-4o-mini)

The Sentiment-Agent generates market sentiment analysis for specific stocks. According to the source code in autohedge/workers.py, this agent is configured with model_name="gpt-4o-mini" at lines 26-30. This lightweight model provides sufficient capability for sentiment classification while minimizing token consumption for high-volume market screening.

Risk-Manager (gpt-4.1)

The Risk-Manager produces critical risk metrics including position sizing, maximum drawdown calculations, and portfolio exposure limits. It utilizes the more capable gpt-4.1 model via model_name="gpt-4.1" as implemented in autohedge/workers.py (lines 40-45). The enhanced reasoning capacity ensures accurate risk assessment for capital protection.

Execution-Agent (gpt-4.1)

The Execution-Agent translates strategic decisions into concrete trade orders, specifying order types, quantities, entry prices, and stop-loss levels. It shares the same model configuration as the Risk-Manager, using gpt-4.1 defined at lines 52-57 of autohedge/workers.py to handle the precision required for order generation.

Quant-Analyst (gpt-4.1)

The Quant-Analyst supplies quantitative scores including technical indicator readings, volume analysis, and trend strength calculations. This agent runs on gpt-4.1 as specified in lines 64-68 of autohedge/workers.py, providing the computational depth necessary for numerical market analysis and statistical validation.

Trading-Director (gpt-4.1)

The Trading-Director orchestrates the entire workflow and manages hand-offs to the other specialized agents. Configured with gpt-4.1 at lines 82-84 of autohedge/workers.py, this agent coordinates the cascade of information from initial sentiment analysis through final execution while maintaining strategic coherence across the multi-agent system.

Implementation in autohedge/workers.py

The model assignments are hardcoded in the autohedge/workers.py file, where each agent instantiation passes the model_name argument directly to the swarms.Agent constructor. The director agent additionally defines hand-off mechanisms that delegate tasks to the sentiment, risk, execution, and quant agents based on workflow state.


# Conceptual structure from autohedge/workers.py

from swarms import Agent

# Sentiment Agent - optimized for cost efficiency

sentiment_agent = Agent(
    agent_name="Sentiment-Agent",
    system_prompt=SENTIMENT_PROMPT,
    model_name="gpt-4o-mini",  # Lines 26-30

    max_loops=1,
)

# Risk Manager - high-precision reasoning

risk_agent = Agent(
    agent_name="Risk-Manager",
    system_prompt=RISK_PROMPT,
    model_name="gpt-4.1",  # Lines 40-45

    max_loops=1,
)

# Director - orchestrates with hand-offs

director_agent = Agent(
    agent_name="Trading-Director",
    system_prompt=DIRECTOR_PROMPT,
    model_name="gpt-4.1",  # Lines 82-84

    max_loops=1,
)

Running and Customizing Agent Models

You can interact with these pre-configured agents directly or override the default models for experimentation and cost optimization.

Running the Full Pipeline

To execute the complete trading workflow using the director agent with its default gpt-4.1 configuration:

from autohedge.workers import director_agent

# The director initiates the workflow and automatically invokes other agents

result = director_agent.run(
    "Analyze the stock market and provide a thesis on the overall market position and expected trends."
)

print(result)

Invoking Individual Agents

For targeted analysis using specific models, import individual agents directly from the workers module:

from autohedge.workers import quant_agent

thesis = "Long position on AAPL based on upcoming earnings."
output = quant_agent.run(f"Stock and Thesis from your Director.\n{thesis}")

print(output)  # Returns quantitative scores generated via gpt-4.1

Customizing Model Selection

To experiment with alternative LLMs, instantiate a new Agent with your preferred model_name while reusing the existing system prompts:

from swarms import Agent
from autohedge.prompts import QUANT_PROMPT

custom_quant = Agent(
    agent_name="Custom-Quant-Analyst",
    system_prompt=QUANT_PROMPT,
    model_name="gpt-4-turbo",  # Override the default gpt-4.1

    output_type="str",
    max_loops=1,
    verbose=True,
)

print(custom_quant.run("Stock: TSLA\nThesis: Momentum breakout"))

Summary

  • AutoHedge employs five specialized agents built on the swarms.Agent class, with model configurations centralized in autohedge/workers.py.
  • Sentiment analysis runs on gpt-4o-mini for cost-effective processing of market sentiment at lines 26-30.
  • Core trading logic utilizes gpt-4.1, including the Risk-Manager, Execution-Agent, Quant-Analyst, and Trading-Director (lines 40-84).
  • The Trading-Director orchestrates multi-agent workflows via hand-off mechanisms while operating on gpt-4.1.
  • All model selections are customizable by creating new Agent instances with different model_name parameters without modifying the core source files.

Frequently Asked Questions

Which LLM model does the AutoHedge Sentiment-Agent use?

The Sentiment-Agent uses gpt-4o-mini as explicitly configured in autohedge/workers.py at lines 26-30. This model selection balances capability and cost efficiency for high-volume sentiment analysis tasks, distinguishing it from the gpt-4.1 employed by the other four agents.

Can I change the model for a specific agent in AutoHedge?

Yes. While the default agents in autohedge/workers.py use fixed model assignments, you can create custom agent instances by importing the Agent class from swarms and the appropriate system prompt from autohedge.prompts. Specify any supported model_name (such as gpt-4-turbo or gpt-4o) to override defaults for testing or cost optimization.

What is the difference between the Trading-Director and other agents in AutoHedge?

The Trading-Director serves as the orchestration layer that runs on gpt-4.1 and manages workflow coordination through hand-offs to the Sentiment-Agent (gpt-4o-mini), Risk-Manager, Execution-Agent, and Quant-Analyst (all gpt-4.1). While specialized agents perform single-domain tasks, the director integrates their outputs to generate comprehensive trading theses and maintain strategic continuity.

Where are the model names defined in the AutoHedge codebase?

All model names are defined in autohedge/workers.py. The Sentiment-Agent configuration appears at lines 26-30 using model_name="gpt-4o-mini", while the Risk-Manager (lines 40-45), Execution-Agent (lines 52-57), Quant-Analyst (lines 64-68), and Trading-Director (lines 82-84) all specify model_name="gpt-4.1" in their respective Agent instantiations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →