Project: Autoresearch Framework Integration for VIF Swarm Intelligence Orchestrator (Phase 3)
Implemented Karpathy autoresearch pattern into the VIF trading system's multi-agent swarm. Autoresearch is the 8th specialist agent in the council (after FinViz screener, before risk-agent). Its role: iterative research synthesis for signal validation, catalyst analysis, and ad-hoc deep-dives.
The swarm now has a self-directed research capability that agents can invoke for exploratory questions without consuming token budget on trivial lookups. Uses 24-hour query cache to prevent redundant research calls.
Framework Context:
- Base: SwarmOrchestrator (KV cache + latent memory + gossip routing + consensus)
- Layer 40: Autoresearch hidden state (confidence scores, topic maps, novel insights)
- Integration: Full pipeline support (premarket, market_open, afterhours, weekend, full modes)
class NativeAutoResearchAgent(SpecialistAgent):
def execute(self, subtasks=None, kv_cache_binding=None, latent_memory=None, task_context=None):
# 3-iteration max research loop
# Input: task_context["research_query"]
# Output: {"findings": str, "confidence_score": float, "topics": list,
# "novel_insights": list, "execution_time_ms": int,
# "cache_hit": bool, "token_cost": int}- Decompose Query — Break research_query into 3 sub-questions
- Search Findings — Execute web search for each sub-question (using WebSearch tool)
- Synthesize — Distill results into structured findings + confidence scoring
- Per-query: ~500 tokens (3 searches @ ~150 tokens each + synthesis)
- 24-hour query cache: identical queries return cached result (0 tokens)
- Monthly impact: ~0.5% overhead (negligible, ~$0.0006/day)
- Skip logic: Only runs if task_context includes
research_querykey
- Layer 40 (exclusive to autoresearch): Hidden state with confidence + topic embeddings
- No conflict with existing layers (8, 16, 24, 32)
- Shared with downstream agents (risk-agent reads layer 40 for research context)
@tool
def run_autoresearch(research_query: str, context_signals_json: str = "") -> str:
"""Execute iterative research loop for a trading question."""
# Called by ProductionSwarmBridge.orchestrator (ManagedAgent)
# Called by ResearchSwarmBridge.agent (CodeAgent)
# Returns JSON string with findings + metadataImplementation Status: ✓ COMPLETE
| File | Status | Details |
|---|---|---|
swarm/native_autoresearch_agent.py |
✓ NEW | 341 lines, full SpecialistAgent implementation |
swarm/__init__.py |
✓ UPDATED | +import, +all entry |
agents/orchestrator_swarm.py |
✓ UPDATED | +import, +agent_pool entry, +layer 40, +log lines |
swarm/smolagents_bridge.py |
✓ UPDATED | +run_autoresearch @tool (both bridges) |
- ✓ Import test:
from swarm import NativeAutoResearchAgentpasses - ✓ Execute test: Agent.execute() with mock task_context returns valid JSON
- ✓ Orchestrator integration: 8-agent council visible in log output
- ✓ Layer 40 initialization: Latent memory includes autoresearch layer
- ✓ @tool registration: run_autoresearch available in both ProductionSwarmBridge and ResearchSwarmBridge
Completed autoresearch agent implementation and full swarm integration. All 4 files updated, all imports verified, orchestrator logs confirm 8-agent council with layer 40. Agent positioned correctly (7th, before risk-agent). Ready for pipeline execution.
-
Execute autoresearch in premarket pipeline — Verify agent runs without errors
python agents/orchestrator_swarm.py --mode premarket 2>&1 | grep autoresearchExpected: Autoresearch logs show research_query decomposition, search execution, synthesis output
-
Verify token efficiency — Confirm overhead is <0.5% of daily budget
- Check orchestrator log for token_cost field in autoresearch output
- Validate cache_hit=true on repeated queries within 24h
-
Test research_query injection — Ensure task_context properly passes research queries
- Monitor critic agent integration: Does critic call autoresearch for low-confidence signal validation?
- Monitor catalyst monitor: Does it request autoresearch for unusual macro patterns?
-
Optional: Add autoresearch triggers — Configure when agents should request research
- Critic agent: Trigger on signals < 55% confidence
- Catalyst monitor: Trigger on novel policy/earnings catalysts
- FinViz screener: Trigger on outlier stock discoveries
-
Finviz Swarm Integration Pending — 6 known bugs blocking FinViz from running in swarm mode
- Status: Tabled May 10, awaiting system research
- See:
docs/~$STEM_CONTEXT.md(legacy) and memory filefinviz_pending_fixes.md
- Prior Session Work: CORZ long calls HTML strategy report (reports/corz_long_calls_strategy.html) — completed May 11
- Scheduler Status: Next jobs May 11 (07:00 premarket, 08:45 catalyst, etc.)
- Active Terminals: TradingView (CDP port 9222), Claude Code session (bypassPermissions=true, effort=low)
- Model: Haiku 4.5 (cost-optimized)