[BUG] Interrupted tool call ends its execute_tool span with no output event, so AgentCore Evaluations cannot parse the session
Checks
- [ ] I have updated to the lastest minor and patch version of Strands — observed on 1.52.0; the code path is unchanged in 1.57.1 (line numbers below are from 1.57.1)
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched ./issues and there are no duplicates of my issue — #3609 is related (see below) but is a different defect
SDK Language
Python
Strands Version
1.52.0 (observed); source inspected unchanged in 1.57.1
Language Runtime Version
Python 3.13
Operating System
Linux (Amazon Bedrock AgentCore Runtime container)
Installation Method
pip (uv)
Steps to Reproduce
- Create an agent with one tool and a
BeforeToolCallEventhook that raises an interrupt for that tool (event.interrupt(...)), so the tool call pauses for human confirmation. - Export telemetry with OpenTelemetry (we use ADOT on AgentCore Runtime; spans go to
aws/spans, span events to the runtime log group). - Invoke once. The invocation ends carrying the interrupt.
- Invoke again on the same session, resuming the interrupt with an approval. The tool runs.
- Inspect the
execute_tool <tool>span of the first invocation and its event record.
Expected Behavior
The interrupted execute_tool span records what happened to the call — an output event describing the interrupt (or some equivalent marker) — so that its event record has the same input + output shape as every other tool span, and consumers of GenAI semantic-convention telemetry can parse it.
Actual Behavior
The interrupted span ends with status OK and an event record carrying body.input only. Every other tool span in the session, including the resumed call to the same tool in the second invocation, carries body.input and body.output.
The cause is in the executor's interrupt branch, which ends the span with no result:
strands/tools/executors/_executor.py:463(1.57.1;:349-366in 1.52.0) —tracer.end_tool_call_span(tool_call_span, tool_result=None)onToolInterruptEvent, and the same call at:115on the middleware path.strands/telemetry/tracer.py,end_tool_call_span— thegen_ai.output.messagesevent is written only underif tool_result is not None(:597in 1.57.1).
Additional Context
Impact: AgentCore Evaluations cannot score any session that used an interrupt. Every trace-level evaluator fails on both invocations' traces with:
SpanEventParsingException: Failed to parse event body for span with ID: <id of the interrupted execute_tool span>
because a trace-level evaluator's context includes earlier turns. Sessions without an interrupt, in the same batch, score normally. We confirmed it is this record by on-demand Evaluate over edited copies of the session's spans (diagnostic inputs only):
| Input | Result |
|---|---|
| As captured | SpanEventParsingException on the interrupted execute_tool span |
| That span's event record removed | LogEventMissingException — the event is required |
An empty output half added |
SpanEventParsingException, unchanged |
The resumed call's own output half copied onto it |
the tool span parses; the failure moves to the next defect below |
A second failure, not in this SDK's power alone. With the above patched, the resumed invocation's invoke_agent span fails AgentSpanMappingException: Failed to parse user_query from agent-span, because a resumed invocation is entered with the interrupt response rather than a user message. That is the evaluation service's extractor against the SDK's resume shape; the same symptom is described from a different path (managed harness, client-side tools) in this comment on #3609. It belongs to the evaluation service and is outside this issue; it is mentioned here only so a fix for this issue is not expected to make interrupted sessions scoreable on its own.
We are not working around this from application code (e.g. writing the output event from the hook), since that would diverge from the SDK's telemetry contract.
Possible Solution
In the interrupt branch, end the span with an output event that records the interrupt — for example a gen_ai.output.messages event whose tool message carries the interrupt's name/reason, or a status/attribute plus a minimal output message — rather than tool_result=None. Whether the span status should stay OK/UNSET for a pause (it is not an error) is worth deciding deliberately, as #3609 discusses for cancellation.
Related Issues
#3609 (spans dropped on cancellation/interrupt; a comment there reports the AgentSpanMappingException half of the AgentCore Evaluations impact)
Confirmed on current main. Both interrupt branches in strands-py/src/strands/tools/executors/_executor.py end the span with tool_result=None: line 115 (the ExecuteToolStage middleware path) and line 463 (the BeforeToolCallEvent hook path). end_tool_call_span only writes the output event when tool_result is set, so the interrupted span carries the input half only.
I'd like to fix this. The shape I have in mind: give the tracer an interrupt branch that writes the same output event a normal result gets (gen_ai.output.messages under the latest conventions, gen_ai.choice otherwise) with the interrupt's name and reason in the tool message, set gen_ai.tool.status to interrupted, and leave the span status unset, since a pause isn't an error. Both executor sites would use it. Cancellation and timeouts (#3609) stay out of scope.
The TS SDK has the same gap for interrupts raised inside a tool: executor.ts ends the span in finally with no toolResult when an InterruptError propagates. Hook interrupts there fire before the span starts, so no span is written at all. I can follow up with a TS PR once the Python shape is agreed.
A follow-up data point: the missing output event also blocks AgentCore Evaluations' built-in tool-level evaluators, not only trace-level ones.
On the same setup (1.52.0), we ran the built-in Builtin.ToolSelectionAccuracy and Builtin.ToolParameterAccuracy on demand against a resumed session, as captured. We targeted two spans with evaluationTarget.spanIds: the resumed call's execute_tool span and the interrupted call's own span. All four calls fail with SpanEventParsingException on the interrupted span's event, including the ones where that span isn't the target.
So on this session the event breaks evaluation at both the trace and the tool level, not only for the trace that contains it. We haven't tested session-level evaluators.