-
Notifications
You must be signed in to change notification settings - Fork 578
Description
Problem Statement
The current Strands A2A integration (StrandsA2AExecutor) only supports a minimal subset of the A2A protocol's task lifecycle states. Specifically:
Current Implementation:
- Uses only
TaskState.workingduring streaming - Calls
updater.complete()when done cancel()raisesUnsupportedOperationError
Missing A2A Task States:
| State | Purpose | Currently Supported |
|---|---|---|
submitted |
Initial task submission | ❌ |
working |
Task in progress | ✅ |
input_required |
Agent needs more user input | ❌ |
completed |
Task finished successfully | ✅ |
canceled |
Task intentionally stopped | ❌ |
failed |
Unrecoverable error occurred | ❌ |
rejected |
Agent refused the task | ❌ |
auth_required |
Authentication needed | ❌ |
The most critical missing state is input_required, which is essential for interactive agent workflows where an agent needs to pause execution and request additional information from the caller before proceeding.
Proposed Solution
- Expose the
TaskUpdaterto Strands agents so they can signal state transitions during execution:
# Example: Agent signals it needs more input
await updater.requires_input(
message=new_agent_text_message("Please provide your API key to continue")
)-
Map Strands agent events to A2A states:
- When a Strands agent uses an interrupt mechanism or similar, translate to
input_required - Map exceptions/errors to
failedstate - Support explicit rejection via
rejectedstate
- When a Strands agent uses an interrupt mechanism or similar, translate to
-
Implement
cancel()support inStrandsA2AExecutor -
Add convenience methods or hooks in the Strands Agent that allow signaling these states:
# Hypothetical API
@tool
def process_request(context: ToolContext):
if need_more_info:
context.request_input("Please provide additional details") # triggers input_required
# ...Use Case
Orchestrator-Subagent Communication with Mid-Process Input Requests
In multi-agent systems, an orchestrator delegates tasks to subagents via A2A. Subagents often need to:
- Request clarification - A subagent processing a document may need user confirmation on ambiguous content
- Gather missing information - A booking agent may need additional traveler details mid-workflow
- Obtain authorization - A financial agent may need approval before proceeding with a transaction
- Handle interactive workflows - Any agent that requires human-in-the-loop decision making
Example Flow:
Orchestrator → Subagent: "Book a flight to NYC"
Subagent → Orchestrator: [input_required] "What date would you prefer?"
Orchestrator → User: "The agent needs a date"
User → Orchestrator: "December 25th"
Orchestrator → Subagent: "December 25th"
Subagent → Orchestrator: [completed] "Flight booked for Dec 25th"
Without input_required support, subagents cannot properly pause and request information, breaking the interactive workflow pattern that A2A was designed to enable.
Alternatives Solutions
No response
Additional Context
-
A2A Protocol Specification: The Agent-to-Agent (A2A) protocol (spec) defines these task states as core to the protocol. The
input_requiredstate is specifically designed for interactive agent workflows. -
Official A2A Python SDK: The
a2a-pythonSDK provides aTaskUpdaterclass with convenience methods for all state transitions:requires_input()- transitions toinput_requiredrequires_auth()- transitions toauth_requiredfailed()- transitions tofailedreject()- transitions torejectedcancel()- transitions tocanceled
-
Event Consumer Behavior: The A2A event consumer is designed to stop consuming on
input_required(see a2a-python#167), indicating this is a well-defined pause point in the protocol. -
Strands has related concepts: The SDK already has
interrupttypes (src/strands/types/interrupt.py) and hooks system that could potentially be leveraged for implementing these state transitions.