marchwarden/researchers/web
Jeff Smith b510902af3 Mirror trace steps to operational logger
The trace JSONL captures every step of a research call (search,
fetch, iteration boundaries, synthesis), but the structured
operational log only fired at research_started / research_completed,
giving administrators no real-time visibility into agent progress.

Have TraceLogger.log_step also emit a structlog event using the
same action name, fields, and step counter. trace_id and researcher
are already bound in contextvars by WebResearcher.research, so
every line carries them automatically — no plumbing needed.

Volume control: a curated set of milestone actions logs at INFO
(start, iteration_start, synthesis_start/complete/error, budget_-
exhausted, complete). Chatty per-tool actions (web_search,
fetch_url and their *_complete pairs) log at DEBUG. Default
MARCHWARDEN_LOG_LEVEL=INFO shows ~9 lines per call;
MARCHWARDEN_LOG_LEVEL=DEBUG shows everything.

This keeps dev stderr readable while making full step visibility
one env var away — and OpenSearch can ingest at DEBUG always.

Verified end-to-end: Utah peak query at INFO produces 9 milestone
log lines, at DEBUG produces 13.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 16:22:13 -06:00
..
__init__.py Initial project structure and scaffolding 2026-04-08 11:57:15 -06:00
__main__.py M1.4: MCP server wrapping web researcher 2026-04-08 14:41:13 -06:00
agent.py M2.5.2: Cost ledger with price table (#25) 2026-04-08 15:52:25 -06:00
models.py Add OpenQuestion to research contract 2026-04-08 14:37:30 -06:00
server.py M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
tools.py M1.1: Search and fetch tools with tests 2026-04-08 14:17:18 -06:00
trace.py Mirror trace steps to operational logger 2026-04-08 16:22:13 -06:00