"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(hypotheses): forward validation evidence through link_backtest tool
Lanre Shittuce8e022a6522
diff --git a/agent/src/tools/hypothesis_tool.py b/agent/src/tools/hypothesis_tool.pyindex 7f4465c86..77368d1b7 100644--- a/agent/src/tools/hypothesis_tool.py+++ b/agent/src/tools/hypothesis_tool.py@@ -140,6 +140,10 @@ class LinkBacktestTool(BaseTool):"run_card_path": {"type": "string", "description": "Path to run_card.json"},"backtest_run_dir": {"type": "string", "description": "Backtest run directory"},"metrics": {"type": "object", "description": "Optional metrics summary"},+ "validation": {+ "type": "object",+ "description": "Optional walk-forward/Monte-Carlo/bootstrap robustness results",+ },"notes": {"type": "string", "description": "Optional link note"},},"required": ["hypothesis_id"],@@ -153,6 +157,7 @@ class LinkBacktestTool(BaseTool):run_card_path=str(kwargs.get("run_card_path", "")),backtest_run_dir=str(kwargs.get("backtest_run_dir", "")),metrics=kwargs.get("metrics"),+ validation=kwargs.get("validation"),notes=str(kwargs.get("notes", "")),)return _ok({"hypothesis": hyp.to_dict()})diff --git a/agent/tests/test_hypothesis_registry.py b/agent/tests/test_hypothesis_registry.pyindex 1a7bf4c81..998abac8a 100644--- a/agent/tests/test_hypothesis_registry.py+++ b/agent/tests/test_hypothesis_registry.py@@ -128,6 +128,31 @@ def test_link_backtest_run_card(storage_path: Path) -> None:assert link["notes"] == "First daily vectorized run."+def test_link_backtest_tool_forwards_validation_evidence(storage_path: Path) -> None:+ """The validation evidence an agent attaches via the tool must reach the+ persisted run card, not be silently dropped on the way to the registry.+ """+ registry = HypothesisRegistry()+ hyp = registry.create(title="ETF momentum", thesis="ETF momentum persists monthly.")++ result = json.loads(+ LinkBacktestTool().execute(+ hypothesis_id=hyp.hypothesis_id,+ backtest_run_dir="/tmp/backtest_run",+ metrics={"sharpe": 1.2},+ validation={"monte_carlo": {"p_value_sharpe": 0.83, "n_simulations": 1000}},+ notes="Attaching Monte Carlo permutation evidence.",+ )+ )++ assert result["status"] == "ok"+ link = result["hypothesis"]["run_cards"][0]+ assert link["validation"] == {"monte_carlo": {"p_value_sharpe": 0.83, "n_simulations": 1000}}++ persisted = HypothesisRegistry().list()[0]+ assert persisted.run_cards[0]["validation"]["monte_carlo"]["p_value_sharpe"] == 0.83++def test_search_by_text_and_status(storage_path: Path) -> None:registry = HypothesisRegistry()crypto = registry.create(