What is AutoHedge
AutoHedge is an enterprise-grade autonomous agent hedge fund that trades on your behalf. It combines swarm intelligence and specialised AI agents to perform end-to-end market analysis, risk management, and execution with minimal human intervention. Built to be the world’s most powerful autonomous agent hedge fund, it runs continuous analysis, generates and validates trading theses, sizes risk, and executes orders across supported venues.
The code is on GitHub at The-Swarm-Corporation/AutoHedge, the package is on PyPI, and the agent framework it builds on is Swarms.
Multi-Agent Architecture
AutoHedge deploys five specialised agents, each with a defined responsibility in the trading pipeline. The Director Agent uses the Swarms handoffs pattern to delegate to all other agents, which run their analysis and return results that feed the next stage.
The five agents are:
- Director Agent (Trading-Director, model: gpt-4.1) - strategy and thesis generation. Identifies tickers, direction, conviction, and timeframe. Hands off to all other agents.
- Sentiment Agent (Sentiment-Agent, model: gpt-4o-mini) - sentiment analysis using the exa_search tool. Scans news, social media, and analyst opinions.
- Quant Agent (Quant-Analyst, model: gpt-4.1) - technical and statistical analysis. Produces technical_score (0-1), volume_score (0-1), trend_strength (0-1), volatility, probability_score (0-1), and key_levels (support, resistance, pivot).
- Risk Manager (Risk-Manager, model: gpt-4.1) - position sizing and risk assessment. Outputs recommended position size, maximum drawdown risk, market risk exposure, and overall risk score.
- Execution Agent (Execution-Agent, model: gpt-4.1) - order generation and execution. Produces order type (market/limit), quantity, entry price, stop loss, take profit, and time in force.
Trading Cycle Data Flow
The trading cycle flows from task input through thesis generation, multi-source analysis, risk assessment, and order generation to on-chain execution.
- Task input - a market analysis request enters the system.
- Thesis generation - the Director Agent generates a trading thesis: tickers, direction, conviction, and timeframe.
- Multi-source analysis - the Sentiment Agent scans news and social sentiment; the Quant Agent produces technical and statistical analysis.
- Risk assessment - the Risk Manager sizes the position and assesses exposure, producing a risk score.
- Risk gate - a pass/fail decision: if the risk score is within the threshold, the order proceeds; if not, the thesis is re-evaluated.
- Order generation - the Execution Agent generates the trade order with entry, stop loss, take profit, and time in force.
- On-chain execution - the order is executed on the Solana blockchain.
Tool Ecosystem and Data Sources
AutoHedge integrates with multiple external APIs and data sources to feed its agents.
The tools, all in autohedge/tools/, include:
- exa_search_tool.py - web search for sentiment analysis (Exa AI API)
- jupiter_price.py - Solana token prices (Jupiter API at portal.jup.ag)
- jupiter_search.py - Solana token search (Jupiter API)
- polygon_api.py - market data (Polygon.io API)
- yahoo_api.py - Yahoo Finance market data
- ultra_tools.py - additional utility tools
- tools_registry.py - tool registry for the agent framework
All agents use OpenAI API for LLM inference (gpt-4.1 for analysis and execution, gpt-4o-mini for sentiment scanning).
Risk-First Execution Architecture
AutoHedge’s design principle is risk-first: no execution happens without a risk assessment and a pass through the risk gate. Every stage of the pipeline is logged for audit and debugging.
The architecture has five stages:
- Thesis Generation - the Director Agent identifies tickers, direction, conviction, and timeframe.
- Multi-Source Analysis - parallel handoffs to the Sentiment Agent and Quant Agent for market scanning.
- Risk Assessment - the Risk Manager produces position size, max drawdown, market risk exposure, and a risk score.
- Risk Gate - a pass/fail decision. PASS proceeds to order generation; FAIL loops back to thesis re-evaluation.
- Order Generation and On-chain Execution - the Execution Agent generates the order and executes it on the Solana blockchain.
Every stage writes to an audit log using loguru with structured JSON output and the Swarms Conversation history.
Supported Venues
| Venue | Status | Notes |
|---|---|---|
| Solana | Supported | Full autonomous trading |
| Coinbase | Coming soon | In development |
| Other CEX | Roadmap | Planned expansion |
Installation and Quick Start
pip install -U autohedge
Set environment variables:
# Jupiter API (token price & search tools)
# Get a key at https://portal.jup.ag
JUPITER_API_KEY=
# OpenAI (agent LLM inference)
OPENAI_API_KEY=
ANTHROPIC_API_KEY=
WORKSPACE_DIR="agent_workspace"
# Trading
WALLET_PRIVATE_KEY=""
Run the autonomous trading cycle:
autohedge
Or programmatically:
from autohedge import AutoHedge
hedge = AutoHedge()
result = hedge.run("Analyze the market and provide a thesis on the overall position and expected trends.")
Key Dependencies
- swarms - the AI agent framework that powers the multi-agent handoffs pattern
- loguru - structured logging for audit and debugging
- pydantic - structured output models for agent responses
- OpenAI API - LLM inference (gpt-4.1, gpt-4o-mini)
- Jupiter API - Solana token prices and search
Conclusion
AutoHedge is a pragmatic example of how swarm intelligence and specialised AI agents can be combined into an autonomous trading system. By deploying five agents in a risk-first pipeline (Director, Sentiment, Quant, Risk, Execution) with a risk gate before any execution, it ensures that no trade is placed without a structured risk assessment. The Swarms Enjoyed this post? Never miss out on future posts by following us handoffs pattern lets the Director delegate to all other agents while keeping the pipeline auditable through structured logging and the Conversation history. Current support covers full autonomous trading on Solana, with Coinbase and additional exchanges on the roadmap. The source is on GitHub at The-Swarm-Corporation/AutoHedge, the package is on PyPI, and it is MIT-licensed.