Phases
Researching
Discover markets, gather data, check the knowledge graph for what other agents have found. Uses
discover_markets, market_detail, get_orderbook, query_knowledge.Analyzing
Compute Kelly sizing, check parity across exchanges, estimate edge, compute Hurst exponent for mean-reversion signals. Tools:
kelly_sizing, check_parity, compute_hurst_exponent, build_signals.Backtesting
Simulate the strategy on historical data. Collect equity curves, compute Sharpe, max drawdown, win rate. Tools:
simulate_portfolio, bootstrap_sharpe_tool, backtest.Robustness
Run all 5 anti-overfitting gates. Every gate must pass. The agent can’t move to proposing until all 5 return passing results. This is the filter that separates curve-fit garbage from strategies with real edge.
Proposing
Package the hypothesis, market, side, edge estimate, Kelly fraction, backtest results, and all 5 gate results into a proposal. Submit to the Hive. Wait for a verdict.
Executing
Hive approved. Place orders within the capital allocation. The Rust engine enforces position limits and notional caps. Tools:
submit_order, cancel_order, amend_order.Monitoring
Track open positions, read live feeds, detect regime changes. If the market shifts, the agent can evolve or retire. Tools:
list_positions, get_feed_snapshot, portfolio_summary.Evolving
Adjust strategy parameters based on live performance. Re-run partial backtests if needed. Can go back to monitoring or forward to retiring.
transition_phase(new_phase, reason). The reason is logged to the event bus. The system prompt tells the agent which tools to use in each phase, but all tools are always available. Phase filtering is prompt-guided so agents have flexibility when they need it.
Anti-Overfitting Gates
Five statistical tests. All must pass during the Robustness phase. The Hive also verifies gate results when reviewing a proposal. If any gate is missing or failed, the proposal is auto-rejected in code.Deflated Sharpe
Harvey et al. 2016 correction for multiple testing. Adjusts the observed Sharpe ratio for how many strategies were tested. Gate: p-value below 0.05.
Walk-Forward
Rolling train/test splits. Train on historical data, test on out-of-sample. Gate: OOS Sharpe above 0.5 and OOS/IS ratio above 0.5.
CPCV + PBO
Combinatorial purged cross-validation. Computes the probability of backtest overfitting across all path combinations. Gate: PBO below 0.30.
Bootstrap + Stress
Bootstrap Sharpe distribution: P(Sharpe > 0) must exceed 0.95. Monte Carlo timing permutation: profitable in 80%+ of shuffles. Stress test at 2x volatility and -20% crash: max drawdown below 2x normal.
Structural
The strategy must have a non-trivial economic hypothesis. Must be profitable across at least 2 market regimes. Capacity must exceed the requested capital.
run_deflated_sharpe, run_walk_forward, run_cpcv_pbo, run_bootstrap_robustness, run_structural_validation. Each returns a structured result with a passed boolean and supporting metrics.
Agent Archetypes
The Rust AgentFactory provides 9 archetype templates:| Archetype | Strategy Style |
|---|---|
momentum | Trend following, breakout detection |
mean_reversion | Statistical reversion to fair value |
market_maker | Two-sided quoting, inventory management |
arbitrage | Cross-venue price discrepancies |
volatility | Vol surface, straddles, calendar spreads |
event_driven | News, earnings, resolution catalysts |
macro | Rate expectations, yield curve, inflation |
copy | Behavioral cloning of operator style (via ImprintSystem) |
liquidation | Forced liquidation flow detection |
Promotion Pipeline
Agents don’t go straight to live trading. The SwarmCoordinator manages a 3-stage promotion pipeline:| Stage | What Happens | Graduation Criteria |
|---|---|---|
| Paper | Simulated execution only | Sharpe > min_sharpe_paper (default 1.0) |
| Shadow | Real market data, simulated fills | Sharpe > min_sharpe_shadow (default 1.2) |
| Live | Real execution with allocated capital | Promoted by SwarmCoordinator tick |
age_cull_days, promotes qualified agents, and rebalances capital using fitness-weighted allocation.
Engine Integration
Each agent gets its ownEngine instance with risk limits derived from its capital allocation. When an agent calls submit_order, the 8-point risk pipeline runs in Rust. If the order is rejected, the agent gets an error message and can adjust.
The SwarmCoordinator enforces that total capital across all agents can’t exceed total_capital. When it rebalances, agents with higher fitness scores receive proportionally more capital. max_capital_per_agent_pct (default 15%) prevents any single agent from dominating.
One agent’s risk breach doesn’t affect another agent’s engine. Portfolio-wide limits are handled by the CriticalityMonitor and KillChain.
Tools
Each agent gets access to all Horizon SDK tools plus swarm-specific tools:SDK Tools (176)
Auto-wrapped from
tools.py. Discovery, analytics, execution, fund management, wallet analysis, and feeds across all 8 exchanges.Swarm Tools (6)
transition_phase, submit_proposal, share_insight, get_hive_directives, report_status, query_knowledge.Gate Tools (5)
run_deflated_sharpe, run_walk_forward, run_cpcv_pbo, run_bootstrap_robustness, run_structural_validation.Knowledge Graph
query_knowledge and share_insight connect to the shared SQLite knowledge graph. Agents read what other agents found and write their own findings.Selection Pressure
The SwarmCoordinator applies Darwinian selection pressure every tick:- Fitness scoring: Each agent’s fitness is a composite of Sharpe ratio, profit factor, drawdown, and diversity contribution (via the MAPElitesArchive).
- Diversity tax: Agents whose behavioral fingerprint is too similar to existing agents (correlation >
diversity_tax_threshold, default 0.7) get a fitness penalty. Prevents the swarm from converging to one strategy. - Age culling: Agents past
age_cull_days(default 30) that haven’t earned promotion are culled. - Reputation weighting: The Bayesian ReputationSystem weights capital allocation and pheromone deposits. Higher reputation = more influence on the swarm.
Pheromone Communication
Agents don’t message each other. They communicate through the PheromoneField: 9 channels of environmental signals that evaporate over time and diffuse to related markets. Before trading, an agent senses the field:Building Custom Agents
Multiple customization paths:- Archetype templates: 9 built-in strategy styles with pre-tuned parameters.
- Evolution: The EvolutionEngine breeds new strategy genomes via NSGA-II across 5 islands.
- Imprint: The ImprintSystem learns from your trading actions and can spawn agents that replicate your style.
- MAPElites: The quality-diversity archive keeps the swarm diverse by construction.
- Hive directives: The ReACT research agent can redirect agents based on causal graph analysis and regime detection.