M1.3: Inner agent loop #5

Merged
archeious merged 1 commit from feat/agent-loop into main 2026-04-08 20:29:41 +00:00
Collaborator

Summary

Core agentic research loop — the heart of the web researcher:

  • Claude-driven tool-use loop (web_search + fetch_url)
  • Budget enforcement (max_iterations + token_budget)
  • Synthesis step producing structured ResearchResult JSON
  • Fallback result when synthesis fails
  • Full trace logging at every step
  • Populates all v1 contract fields

9 tests (all mocked, no real API calls).

Refs: #1

## Summary Core agentic research loop — the heart of the web researcher: - Claude-driven tool-use loop (web_search + fetch_url) - Budget enforcement (max_iterations + token_budget) - Synthesis step producing structured ResearchResult JSON - Fallback result when synthesis fails - Full trace logging at every step - Populates all v1 contract fields 9 tests (all mocked, no real API calls). Refs: #1
claude-code added 1 commit 2026-04-08 20:29:34 +00:00
WebResearcher — the core agentic research loop:
- Tool-use loop: Claude decides when to search (Tavily) and fetch (httpx)
- Budget enforcement: stops at max_iterations or token_budget
- Synthesis step: separate LLM call produces structured ResearchResult JSON
- Fallback: valid ResearchResult even when synthesis JSON is unparseable
- Full trace logging at every step (start, search, fetch, synthesis, complete)
- Populates all contract fields: raw_excerpt, categorized gaps,
  discovery_events, confidence_factors, cost_metadata with model_id

9 tests: complete research loop, budget exhaustion, synthesis failure
fallback, trace file creation, fetch_url tool integration, search
result formatting.

Refs: archeious/marchwarden#1

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
archeious merged commit ece2455415 into main 2026-04-08 20:29:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/marchwarden#5
No description provided.