All notable changes to AgentQuant will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Shadow idea-generation sidecar (
src/agent/idea_sidecar.py, issue #43), behindAGENTQUANT_IDEA_SIDECAR=1. Non-learning: it replays a fixed heuristic or seeded random policy over the canonical parameter grid and logs a versioned observation/action/reward trajectory. No new dependencies; the default demo never imports it. - Unified memory layer (
src/memory/, design).- Every backtested proposal is recorded as a trial, and holdout results are attached as out-of-sample evidence.
- Reads use a point-in-time
as_ofcutoff enforced in SQL. Beliefs are evidence-weighted: OOS first, in-sample deflated for the number of configs tried, weighted by regime similarity. - Recall returns a token-budgeted
MemoryPackused byagent_graph, the swarm andProposalGenerator. Its snapshot id is written toRunManifest.memory_snapshot_id.
- Dreaming mode:
agentquant dream [--watch]. It backfills legacy memory, replays in-sample-only trials on forward data, writes consolidation notes when verdicts change, and prunes the read log. Heartbeat healthcheck:python -m src.memory.healthcheck. docker-compose.ymlruns the app with the dreamer sidecar on shared volumes.memory:section inconfig.yaml(mode: off | read | read_write, budgets, seeding, dream settings).agentquant memory --beliefs | --trials | --prompt | --stats [--as-of DATE].
- Memory seeds (
generation_method="memory_seed") now come only from configs with out-of-sample "works" beliefs. Previously they were re-proposed in-sample winners fromAlphaStore. reflect_nodeno longer writes onefailure_recordsrow per sub-threshold result per iteration. Failures live on the trial rows.
First tagged, installable release (issue #30). Ships as a built wheel/sdist rather than only being usable from an editable source checkout.
Not published to PyPI yet -- install the tagged wheel from the GitHub release, or build it yourself from the tag:
git checkout v0.3.0
python -m build # writes dist/agentquant-0.3.0-py3-none-any.whl
pip install dist/agentquant-0.3.0-py3-none-any.whl # core: research/backtest CLI, no UI/LLM extras
agentquant run --help
# optional extras, installed only if you need them:
pip install "dist/agentquant-0.3.0-py3-none-any.whl[ui]" # streamlit dashboard + plotting
pip install "dist/agentquant-0.3.0-py3-none-any.whl[llm]" # Anthropic/OpenAI/Gemini/Tavily providers
pip install "dist/agentquant-0.3.0-py3-none-any.whl[dev]" # pytest, for running the test suite
# offline demo, no API keys or network required beyond the initial install:
python run_app.pyInstalling without [ui]/[llm] and importing src.cli / src.agent.agent_graph
/ src.agent.runner works with no missing-import errors; requesting --app
without the ui extra fails with an actionable message naming the extra to
install, not a traceback.
| Extras | Install time | site-packages size |
|---|---|---|
| (none) — core | 11.0s | 474 MB |
[dev] |
10.9s | 550 MB |
[dev,llm] |
21.4s | 789 MB |
[dev,llm,ui] |
24.0s | 978 MB |
These are one machine's snapshot (network-dependent pip resolution time), not
a general performance claim — rerun scripts/measure_cold_install.py to
reproduce on your own environment.
python -m buildproduces an installable wheel/sdist; a clean venv installing that wheel (no editable install, no source checkout onsys.path) runsagentquant --help,agentquant run --help, andagentquant memory --helpsuccessfully from a directory outside the repo.- 183 tests pass (
pytest tests/ -v --cov=src), 0 skipped/xfailed, 69%srccoverage (see #21). - CI's
base-install,wheel-install, andharness-verificationjobs (.github/workflows/ci.yml) cover this: base-only install with runtime network blocked, wheel install run from outside the checkout, and the 6-epoch harness evolution script re-run + drift-checked (#19, #20) on every push/PR.
- No calibrated numerical Sharpe-forecast-accuracy metric; falsifiable claims are recorded as text only (see README Evidence Table).
- GA/DE harness-parameter optimizers benchmark against a mock fitness function, not real backtests.
- Without
ANTHROPIC_API_KEY/TAVILY_API_KEYset, all LLM-tool-calling code paths (proposal generation, harness mutation arms, the newfetch_and_extract_contentliterature tool) fail closed to offline fallbacks rather than silently degrading — expect flat/zero numbers for those paths without a real key, not a bug. use_ensembleandgrid_adaptation_strategyharness knobs are declared but not wired through execution yet; a config requesting them is rejected withUnsupportedHarnessKnobErrorrather than silently ignored.
This release documents the current agentic design and the features added while iterating from a parameter-tuning backtester toward a self-improving research agent.
AgentQuant runs a bounded, evidence-producing loop:
ANALYZE → HYPOTHESIZE → BACKTEST → REFLECT → STORE
↑ │
└──── retry on failure ──┘
- Analyze computes market features and classifies the current regime from volatility, momentum, trend, and drawdown signals.
- Hypothesize combines LLM reasoning, stored alpha memory, regime-aware grid search, and random fallback proposals.
- Backtest evaluates proposals with warmup enforcement, transaction costs, and performance metrics.
- Reflect applies quality gates, records falsifiable proposal claims, and decides whether another bounded iteration is justified.
- Store persists accepted evidence and reusable negative evidence for later runs.
The loop is intentionally bounded: every proposal has parameters, a generation method, reasoning, confidence, and measurable outcomes. This keeps agentic behavior comparable to deterministic baselines instead of treating free-form LLM output as evidence by itself.
The implementation has evolved through these agentic stages:
- Core research platform — multi-strategy OHLCV ingestion, feature engineering, realistic-cost backtesting, metrics, and dashboard views.
- Bounded agent loop — explicit analyze/hypothesize/backtest/reflect/store nodes with retry limits and a single proposal-generation entrypoint.
- Regime-aware proposals — VIX percentile and momentum regimes feed the prompt and parameter-grid priors.
- Persistent learning —
StrategyMemory,AlphaStore, and NLA memory retain cross-run context and successful candidates. - Tool-using orchestration — Claude-compatible tool schemas, optional Tavily research/sentiment search, proposal parsing, and graceful fallback to local generation.
- Harness evaluation — falsifiable claim recording, benchmark tooling, generalization-gap measurements, and experimental harness evolution.
- Failure-aware self-improvement — structured failure records now capture regime, strategy, parameters, failure mode, metric gap, and a counterfactual hypothesis; matched failures are injected as proposal constraints.
- Robustness evaluation — anchored walk-forward utilities report median and worst-window metrics; counterfactual stress tests perturb regimes, volatility, outlier days, and trends.
- Agent observability and extension points — trace diagnostics expose node counts, proposal methods, improvements, and acceptances; regime transitions are detectable; generated strategy source is AST-validated before registry registration.
failure_recordsSQLite table andFailureRecorddataclass insrc/research/alpha_store.py.- Automatic failure persistence from
reflect_node. - Structured failure-memory prompt context in
src/agent/proposal_generator.py. TraceRecorder.diagnostics()and.diagnostics_json()for harness reports.src/backtest/walk_forward.pyfor anchored walk-forward evaluation.src/backtest/stress_test.pyfor counterfactual strategy stress tests.RegimeChangeDetectorfor recording regime-label transitions.src/strategies/codegen.pyfor AST validation and controlled strategy registration.stress_test_strategyin the agent tool registry.
- 70 repository tests pass after integrating the latest
mainchanges. - Unsafe generated imports are rejected before registration.
- No force-push or destructive history rewrite was used for this release.
src/agent/tools/registry.py— Tool schema definitions and execution engine- 5 core tools: regime context, market sentiment, strategy research, parameter recommendations, quality assessment
- JSON schema generation for Claude API compatibility
- Tavily API integration for web search (market sentiment, strategy research)
src/agent/tools/orchestrator.py— Claude tool-use loop orchestrator- Multi-turn tool reasoning with Claude
- Graceful fallback if Claude/Tavily unavailable
- Proposal parsing from JSON responses
src/agent/tools/evals.py— Harness quality evaluation suiterun_benchmark_to_assess_quality()tool for self-assessment- Metrics: OOS Sharpe, stability, generalization gap, tool accuracy
- Actionable recommendations for harness improvement
- Tool system documentation and integration guide (
docs/TOOL_INTEGRATION_GUIDE.md) - Example integrations showing gradual migration paths
- Enhanced
hypothesize_nodewith tool orchestration- Tries Claude tool-use first, falls back to ProposalGenerator
- No breaking changes; tools activate automatically
- Records tool calls in execution trace
- Enhanced
reflect_nodewith falsifiable claim scoring- Tracks proposal accuracy (predicted vs. realized)
- Enables harness to learn which proposals work
- Foundation for harness self-improvement
- JSON proposal parsing from Claude responses
- Integration with existing ProposalValidator
- Support for falsifiable claims in proposal reasoning
- Graceful degradation if parsing fails
- Comprehensive design specification for autonomous research agent
- Three-part architecture: Literature → Hypothesis → Publication
- Research loop: Plan → Search → Hypothesize → Validate → Publish
- Data structures for research tasks, findings, hypotheses, reports
- Quality metrics and research rigor scoring
- Integration points with main agent loop
- 4-phase implementation roadmap
- Updated
.env.examplewith TAVILY_API_KEY, ANTHROPIC_API_KEY placeholders .envremains in.gitignore; secrets never committed to repo- All tools degrade gracefully if API keys missing
pyproject.toml— Addedanthropic>=0.30,tavily-python>=0.3to LLM extrassrc/agent/agent_graph.py— Integrated tool orchestration and claim scoring.env.example— Added web search and Claude API key templates
ac68642— Proposal parsing and deep research agent design383deec— Integrate tool orchestrator into hypothesize and reflect nodes62344e8— Tool registry and orchestration for agentic harness evolution
- Harness Engineering Foundation — Components for self-improving agent architecture
src/agent/strategy_memory.py— Cross-session learning via SQLitesrc/agent/memory_layer.py— Pattern extraction and historical context retrievalsrc/research/alpha_store.py— Alpha candidate persistence and recall- Look-ahead bias guards in backtest engine
- Regime-aware parameter grid sampling
- Scientific Baselines — Experimental harness for rigorous evaluation
experiments/walk_forward_context.py— Walk-forward backtesting with market regime contextexperiments/walk_forward_context_with_costs.py— Realistic trading costsexperiments/ablation_study.py— Parameter sensitivity analysisexperiments/rigorous_baselines.py— Budget-matched baseline comparisons
- Trace & Observability — Execution tracing for agent debugging
src/agent/trace.py— TraceRecorder and hierarchical trace storage
- Agent Graph Refactor — Bounded ReAct loop with 5 explicit nodes
analyze→hypothesize→backtest→reflect→store- Max iterations with reflect-retry loop on Sharpe threshold
- Proposal Generator Consolidation — Single entrypoint replacing 4 planner files
- Fallback chain: LLM → Grid Search → Random
- Proposals constrained to canonical ParameterGrid for valid A/B comparison
- Regime-aware prior sampling
- Regime Detection — VIX percentile-based instead of absolute levels
src/features/regime.py— Statistical regime classification- Cross-regime performance tracking for harness learning
- Look-ahead bias in backtest metric computation
- Parameter grid constraints validation before backtest execution
- Core Quantitative Research Platform
- Multi-strategy support (momentum, mean reversion, volatility, trend following, breakout)
- OHLCV data ingestion from yfinance
- Feature engineering (technical indicators, regime signals)
- Strategy backtesting with realistic costs (slippage, commission, market impact)
- Metrics computation (Sharpe ratio, returns, drawdown, win rate)
- LLM Integration
- Multi-planner support (Gemini, LangChain, OpenAI, fallback to grid search)
- Temperature-controlled proposal generation
- Configurable retry logic
- Market Data & Features
- VIX, Treasury yields (FRED API integration)
- Multi-asset universe support
- Caching layer for data (24h TTL)
- Streamlit Dashboard
- Live data sidebar with price, VIX, yields
- Agent execution lab
- NLA memory browser
- Research workspace
- Testing & CI/CD
- 42 unit tests covering core systems
- GitHub Actions CI gate
- Config validation, backtest rigor, memory consistency checks
- Introduced bounded ReAct loop with formal state machine
- Cross-session memory persistence (StrategyMemory, AlphaStore)
- Regime-aware sampling and statistical regime detection
- Walk-forward validation harness
- Foundation for harness evolution and tool-based orchestration
- Multi-strategy backtesting engine
- LLM-guided parameter selection
- Dashboard and monitoring
- Comprehensive test coverage
- Tool-calling orchestrator (in progress)
- Weakness mining from execution traces
- Falsifiable claims tracking and scoring
- Grid evolution (learn parameter space from results)
- Prompt template variation and ranking
- Held-out test window evaluation protocol
- Generalization gap measurement
- Multi-agent swarm with specialist roles (critic, regime analyst, etc.)
- Iterative hypothesis refinement
- Strategy discovery from web research
- Production deployment harness
None yet. All changes maintain backward compatibility within v0.x → v1.x → v2.x progression.
See DESIGN.md for architecture overview and implementation guidelines.
- DESIGN.md — Technical design document (v2.0)
- EXPERIMENTAL_DETAILS.md — Original experimental methodology
- docs/PAPER_DRAFT.md — Research paper draft