fix(agno): create agent spans for continued (human-in-the-loop) runs - #3560
Open
jarstingstall wants to merge 1 commit into
Open
fix(agno): create agent spans for continued (human-in-the-loop) runs#3560jarstingstall wants to merge 1 commit into
jarstingstall wants to merge 1 commit into
Conversation
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>
Contributor
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
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 inagno.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_inputtool → 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/continueendpoint: every HITL tool run appeared to vanish after the pause.What's included
agno.agent._runwith the existing_RunWrappermethods (sync→run, sync stream→run_stream, async→arun, async stream→arun_stream), with the samegetattrguards 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.){agent}.continue_run/{agent}.acontinue_run, with stream variants collapsing to the base name — the same convention the existing.run/.arunspans use. Existing span names are unchanged (_span_method_namereturns the current default for the non-continue entrypoints).AGENTspan kind, andsession.idattribute.