Repository navigation
Commit 19afe35
fix(pydantic-ai): trace step persistence lineage on agent iter (#1198)
## Summary
Follow-up to #1194 and #1192. The direct `Agent.iter()` root span added
in #1192 was not passed into the Step Persistence lineage capture added
in #1194. With Harness installed, `iter()` raised `TypeError:
_start_tool_trace_capture() missing 1 required positional argument:
'agent_span'`.
`tracing.py` now passes the `iter()` task span into the existing
capture, so `metadata.step_persistence.{run_id, parent_run_id}` gets
recorded on `iter()` runs the same way as on `run()` / `run_stream()`.
Source and fork runs stay in separate traces.
The new test case in `harness/test_step_persistence.py` replays a real
OpenAI Responses cassette
(`test_step_persistence_lineage[fork_run-iter].yaml`). `run_stream()`
lineage already has VCR coverage on main from #1194.
Link to Devin session:
https://braintrust.devinenterprise.com/sessions/b253a31c21104ab8baef1857d38a2cf0
Open in Devin Desktop:
https://braintrust.devinenterprise.com/desktop/session/b253a31c21104ab8baef1857d38a2cf0?variant=devin
Co-authored-by: Abhijeet Prasad <abhijeet@braintrustdata.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 879d456 commit 19afe35
2 files changed
Lines changed: 250 additions & 1 deletion
File tree
- py/src/braintrust/integrations/pydantic_ai/harness
- cassettes/latest
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
65 | | - | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
67 | 75 | | |
68 | 76 | | |
| |||
0 commit comments