Skip to content

feat(tracing): span each tool call on the sync agent path - #494

Closed
mohammadatallah-scale wants to merge 1 commit into
mainfrom
mohammad/ove-693-tool-spans
Closed

feat(tracing): span each tool call on the sync agent path#494
mohammadatallah-scale wants to merge 1 commit into
mainfrom
mohammad/ove-693-tool-spans

Conversation

@mohammadatallah-scale

@mohammadatallah-scale mohammadatallah-scale commented Aug 19, 2026

Copy link
Copy Markdown

Important

Pending Mohammad's self-review. This note is removed by a human, not automation.

The bug: on the sync agent path the only span wraps the LLM inference call, so time an agent spends in tools is not covered by any span and disappears from the SGP dashboard.

The fix: SyncTracingHooks opens a span when a tool starts and closes it when the tool returns, so span width is the tool's real duration. It ports the lifecycle the Temporal plugin already uses, minus the activity plumbing.

Not in this PR: nothing calls these hooks yet. The turn helper that wires them up is #495.

Measured on dev-sgp, 14 days, analyst-agent. Span width is what a timeline renders, so a duration recorded only as an attribute is invisible.

tool calls span width p50 real duration p50 real duration p95
describe_table 3,399 0 ms 1,255 ms 12,620 ms
search_tables 1,849 0 ms 10,670 ms 20,021 ms
run_query 1,357 0 ms 1,638 ms 31,238 ms
search_columns 461 0 ms 1,382 ms 5,975 ms
list_tables 13 1 ms 26,288 ms 49,522 ms
  • 11 unit tests, including that a tracing failure never propagates into the tool call
  • Live dev-sgp run, once the turn helper on top of this lands

The sync path only spans Model.stream_response, the inference call. The Runner
executes tools outside it, so tool time falls into gaps between spans and
nothing accounts for it. On dev-sgp an agent with slow tools reported a third
of its real wall-clock time.

SyncTracingHooks ports the span lifecycle the Temporal plugin already uses,
minus the activity plumbing, so both paths emit the same trace shape.
@github-actions

Copy link
Copy Markdown

This PR is targeting main, but PRs should target the next branch by default.

The main branch is reserved for release-please and Stainless automation. To resolve, pick one of:

  • Re-target the PR to next (recommended). On the PR page, click Edit next to the title and change the base branch to next.
  • Add the target-main label if this is an intentional exception (e.g. an urgent hotfix). The check will re-run and pass.

See CONTRIBUTING.md for the full branch model.

@mohammadatallah-scale

Copy link
Copy Markdown
Author

Closing unmerged. The approach stands, it just needs a live dev-sgp run behind it before it should land.

Kept as the starting point on OVE-694. Branch mohammad/ove-693-tool-spans (035be543) stays pushed, so whoever picks it up can branch straight off it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant