Skip to content

Hierarchical swarm agent (example 13) never terminates — non-converging handoff loop (repros in Python, TS, Java) #442

Description

@deeptireddy-lab

Summary

examples/agents/13_hierarchical_agents.py never completes — runtime.run() hangs indefinitely. It reproduces identically in the TypeScript (13-hierarchical-agents.ts) and Java (Example13HierarchicalAgents) SDKs, which strongly suggests the root cause is the shared server-side swarm/handoff orchestration rather than any one client SDK. (Filing here since this is where the runnable reproducer lives; happy to move to conductor-oss/conductor if it's confirmed server-side.)

Environment

  • conductor-oss server 3.32.0-rc.10
  • conductor-oss/python-sdk @ main
  • model anthropic/claude-sonnet-4-6
  • macOS

Repro

AGENTSPAN_SERVER_URL=http://localhost:8080/api \
AGENTSPAN_LLM_MODEL=anthropic/claude-sonnet-4-6 \
python3 examples/agents/13_hierarchical_agents.py

Ran 8+ minutes with no completion on two separate runs; has to be killed.

Expected

The CEO agent (strategy=SWARM) hands off to engineering_lead, then to marketing_lead, and returns a combined answer for the two-part prompt (design a REST API and propose a marketing campaign).

Actual

Non-terminating handoff loop. The log shows:

WARNING  Multiple transfer calls in one turn; honoring 'engineering_lead', dropping ['marketing_lead']

followed by continuous transfer churn; the run never converges.

Likely cause

The CEO uses strategy=Strategy.SWARM with:

handoffs=[
    OnTextMention(text="engineering_lead", target="engineering_lead"),
    OnTextMention(text="marketing_lead",  target="marketing_lead"),
]
  • The OnTextMention trigger text is the agents' own names, which naturally recur in agent outputs ("routing to marketing_lead…") → handoffs keep re-firing.
  • The prompt requests two departments at once, so the model emits multiple transfer calls in a single turn; the runtime drops one ("Multiple transfer calls in one turn") instead of sequencing them.
  • There appears to be no convergence/termination guard, so the swarm loops forever.

Suggested fix

  • Bound swarm handoffs (max transfers, or detect the dropped-transfer/repeat cycle) so a run always terminates.
  • And/or revise the example so OnTextMention triggers aren't the agents' own names, and the prompt maps to a single department per turn.

Cross-SDK note

Same hang observed in:

  • Python: 13_hierarchical_agents.py
  • TypeScript: 13-hierarchical-agents.ts
  • Java: Example13HierarchicalAgents
  • also python-sdk examples/agents/adk/10_hierarchical_agents.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions