Record per-step durations in trace and operational logs #36
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/step-durations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes Issue #35
Change
TraceLoggernow tracks monotonic start times for starter actions and attaches aduration_msfield to the matching completer:web_searchweb_search_completeduration_msfetch_urlfetch_url_completeduration_mssynthesis_startsynthesis_complete/synthesis_errorduration_msstartcompletetotal_duration_secPairings are tightly sequential in the agent code (each
_execute_toolcall runs start→end before returning), so a simple dict keyed by starter name suffices — no queueing needed. An unpaired completer leaves the duration unset and does not crash.Durations flow into both the JSONL trace and the structlog operational log, so OpenSearch queries can filter / aggregate by step latency without cross-row joins.
Verified end-to-end
Real shallow query:
Synthesis is by far the slowest step — visible at a glance for the first time. Useful insight for future optimization.
Tests
7 new tests in
test_trace.py: each pairing's duration field, error-path duration, total seconds, unpaired completer no-crash, existing fields preserved. 123/123 passing.