Repository navigation
feat(run): STRIX_RUN_RECORD_TIMINGS records every LLM request's and tool call's timing in run.json - #1539
Merged
Conversation
… and tokens in llm_requests
Contributor
[Medium impact] The PR appears safe to merge. SummaryAdds per-attempt model request records to
No actionable issues found. Checks were based on source review; tests were not run. Reviews (1) · Last reviewed commit: "feat(llm): run.json records every provid..." · Reviewed by Greptile |
…only with STRIX_RUN_RECORD_TIMINGS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per-request timings exist today only as DEBUG `llm_request` lines in `strix.log`, and tool timings only as event timestamps. Hosted runs and replays don't keep `strix.log`, so there's no way to measure a provider's latency, or where a run's time went, after the fact.
With `STRIX_RUN_RECORD_TIMINGS=true` (off by default), `run.json` gets:
```json
{"started_at": "…", "agent_id": "…", "model": "…", "provider": "Together", "outcome": "success",
"status": 200, "duration_ms": 4200, "ttft_ms": 900, "input_tokens": 90000, "cached_tokens": 85000,
"output_tokens": 600, "retry_attempt": 0}
```
`provider` is the upstream provider behind a gateway (e.g. OpenRouter's) when known, otherwise the route's provider.
Both ride the existing `run.json` saves; on resume, `run_record.update` restores them.
Off by default because of size: about 370 bytes per request, so about 0.5 MB on a median scan (1,100 requests) and 1 MB on a large one. `run.json` is rewritten after every request. strix-app turns it on for PR replays only (usestrix/strix-app#1599).