Skip to content

feat(adapters/langgraph): run a Swarm as a flow step#20

Merged
spichen merged 1 commit into
oi-forkfrom
feat/swarm-as-flow-step
Jun 30, 2026
Merged

feat(adapters/langgraph): run a Swarm as a flow step#20
spichen merged 1 commit into
oi-forkfrom
feat/swarm-as-flow-step

Conversation

@spichen

@spichen spichen commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Symmetric with the ManagerWorkers flow-step support. A Swarm is an AgenticComponent, not an Agent, so an AgentNode wrapping one previously raised TypeError in AgentNodeExecutor and exposed no input ports (a DataFlowEdge into the node could not resolve at load).

  • Swarm._get_inferred_inputs/_get_inferred_outputs expose the entry agent's (first_agent) ports, mirroring ManagerWorkers' group manager, so an AgentNode wrapping a Swarm declares inputs and data edges into it resolve at load.
  • AgentNodeExecutor now dispatches a Swarm flow step: it renders the node inputs into the entry agent's prompt (swapping the rendered agent into both first_agent and the relationship tuples), drops the satisfied input ports, compiles via _swarm_convert_to_langgraph and drives the graph over messages.

Adds tests/adapters/langgraph/flows/test_swarm_node.py.

Symmetric with the ManagerWorkers flow-step support. A Swarm is an
AgenticComponent, not an Agent, so an AgentNode wrapping one previously
raised TypeError in AgentNodeExecutor and exposed no input ports (a
DataFlowEdge into the node could not resolve at load).

- Swarm._get_inferred_inputs/_get_inferred_outputs expose the entry
  agent's (first_agent) ports, mirroring ManagerWorkers' group manager,
  so an AgentNode wrapping a Swarm declares inputs and data edges into it
  resolve at load.
- AgentNodeExecutor now dispatches a Swarm flow step: it renders the node
  inputs into the entry agent's prompt (swapping the rendered agent into
  both first_agent and the relationship tuples), drops the satisfied
  input ports, compiles via _swarm_convert_to_langgraph and drives the
  graph over messages.

Adds tests/adapters/langgraph/flows/test_swarm_node.py.
@spichen spichen merged commit 05a5f83 into oi-fork Jun 30, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant