[FEATURE] Agent-as-tools handoff (Python)
SDK Language
Python
Problem Statement
When using agent-as-tools for delegation, the orchestrator always makes an additional model call to process the sub-agent's response before returning it to the user. This adds latency and token cost for routing scenarios where the sub-agent's output is the final answer. It can also corrupt structured output (JSON, code) by paraphrasing it.
There is currently no way to tell the agent loop to skip the post-processing step during agent-as-tools delegation.
Proposed Solution
Port https://github.com/strands-agents/harness-sdk/issues/3257 to the Python SDK. The developer experience is the same: a delegate boolean option is added to Agent.as_tool(). When true, the agent loop short-circuits after the sub-agent's tool result is received, returning it directly as the AgentResult with stopReason: 'endTurn' instead of feeding it back to the orchestrator model.
# Sub-agents as tools
customer_service = Agent(
name="CustomerService",
system_prompt="...",
)
technical_support = Agent(
name="TechnicalSupport",
system_prompt="...",
)
# Orchestrator with sub-agents as tools
orchestrator = Agent(
tools=[
customer_service.as_tool(handoff=True),
technical_support.as_tool(handoff=True),
],
)
result = orchestrator("My wifi does not work")
# result.message is the sub-agent's response directly
Use Case
- Domain routing: Help-desk orchestrator routes billing to CustomerService, technical issues to TechnicalSupport. Specialist's response is the final answer — no orchestrator post-processing.
- Structured output preservation: Sub-agent generates JSON for a report. JSON reaches the user verbatim without orchestrator paraphrasing.
- Hierarchical delegation: Manager → Senior → Junior. Each level hands off deeper without latency accumulating on the way back up.
Alternatives Solutions
No response
Additional Context
Parent issue: https://github.com/strands-agents/harness-sdk/issues/911 Sibling issue: https://github.com/strands-agents/harness-sdk/issues/3257
Update 7/28:
- Added implementation and got initial strandly reviews
- Need the following merged before continuing: https://github.com/strands-agents/harness-sdk/pull/3508 https://github.com/strands-agents/harness-sdk/pull/3466
Update 8/11: passes Strandly reviews, needs human review