Skip to content

fix(agno): create agent spans for continued (human-in-the-loop) runs - #3560

Open
jarstingstall wants to merge 1 commit into
Arize-ai:mainfrom
jarstingstall:agno-continue-run-instrumentation
Open

fix(agno): create agent spans for continued (human-in-the-loop) runs#3560
jarstingstall wants to merge 1 commit into
Arize-ai:mainfrom
jarstingstall:agno-continue-run-instrumentation

Conversation

@jarstingstall

@jarstingstall jarstingstall commented Aug 14, 2026

Copy link
Copy Markdown

What this is

When an agno run pauses for human-in-the-loop input (requires_user_input, requires_confirmation, or external execution) and is later resumed, the resumed run produces no agent span. The instrumentor wraps the module-level run entrypoints in agno.agent._run (_run, _run_stream, _arun, _arun_stream) but not the continue-run entrypoints agno dispatches to on resume (_continue_run, _continue_run_stream, _acontinue_run, _acontinue_run_stream).

Concretely: an agent calls a requires_user_input tool → the run pauses (traced fine, ends with "I have tools to execute, but I need user input") → the user supplies input → agent.continue_run() / acontinue_run() executes the tool and finishes the run — and none of it has a root agent span. The continuation's model and tool spans start fresh traces with no root, so the resumed portion of the run — including the tool execution the pause was for — is effectively missing from the trace. We hit this in production with agno's AgentOS /continue endpoint: every HITL tool run appeared to vanish after the pause.

What's included

  • Wrap the four continue-run entrypoints in agno.agent._run with the existing _RunWrapper methods (sync→run, sync stream→run_stream, async→arun, async stream→arun_stream), with the same getattr guards and uninstrument restoration as the existing wraps. The continue functions take the agent as their first argument, like _arun, so the wrappers apply unchanged. (Teams have no continue entrypoints — agent module only.)
  • Continuation spans are named {agent}.continue_run / {agent}.acontinue_run, with stream variants collapsing to the base name — the same convention the existing .run/.arun spans use. Existing span names are unchanged (_span_method_name returns the current default for the non-continue entrypoints).
  • Tests: wrapping + uninstrument restoration for all four functions, and span-creation tests asserting the span name, AGENT span kind, and session.id attribute.

The instrumentor wraps the module-level run entrypoints in agno.agent._run
(_run, _run_stream, _arun, _arun_stream) but not the continue-run entrypoints
(_continue_run, _continue_run_stream, _acontinue_run, _acontinue_run_stream),
which agno dispatches to when a run paused for human-in-the-loop input
(requires_user_input / requires_confirmation / external execution) is resumed.

As a result, a continued run produces no agent span: its model and tool spans
start fresh traces with no root, so the resumed portion of the run — including
the tool execution the pause was for — is missing from the trace.

Wrap the four continue-run entrypoints with the existing run wrappers, and name
the resulting spans {agent}.continue_run / {agent}.acontinue_run (stream
variants collapse to the base name, matching the existing .run / .arun
convention). Existing span names are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jarstingstall
jarstingstall requested a review from a team as a code owner August 14, 2026 20:00
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@jarstingstall

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant