Source SDK
strands-ts
Target SDK
strands-py
Related Files
strands-ts/src/interrupt.ts
strands-ts/src/agent/agent.ts
strands-ts/src/__tests__/interrupt.test.ts
strands-ts/src/agent/__tests__/agent.interrupt.test.ts
Description
Tool interrupt replay state (tool_use_message and tool_results) is stored in the Python SDK as ad-hoc string keys in _InterruptState.context, a shared untyped dict. This means the pending-execution predicate is coupled to the data — you can't clear "pending" without deleting the data, and readers access it by string key with no type safety. It also diverges from TypeScript, which already has a typed PendingToolExecution struct with independent lifecycle.
A PendingToolExecution dataclass on _InterruptState (pending_tool_execution: PendingToolExecution | None) would give typed fields, independent lifecycle control (set to None to clear without touching other context), and structural parity with TypeScript's PendingToolExecution interface. The dataclass would replace tool_use_message and tool_results on _InterruptState.context, as well as has_pending_tool_execution.
Confirmation
Source SDK
strands-ts
Target SDK
strands-py
Related Files
Description
Tool interrupt replay state (
tool_use_messageandtool_results) is stored in the Python SDK as ad-hoc string keys in_InterruptState.context, a shared untyped dict. This means the pending-execution predicate is coupled to the data — you can't clear "pending" without deleting the data, and readers access it by string key with no type safety. It also diverges from TypeScript, which already has a typedPendingToolExecutionstruct with independent lifecycle.A
PendingToolExecutiondataclass on_InterruptState(pending_tool_execution: PendingToolExecution | None) would give typed fields, independent lifecycle control (set to None to clear without touching other context), and structural parity with TypeScript'sPendingToolExecutioninterface. The dataclass would replacetool_use_messageandtool_resultson_InterruptState.context, as well ashas_pending_tool_execution.Confirmation