Skip to main content
Swarm Type: AgentRearrange

Overview

The AgentRearrange swarm type implements a dynamic architecture where agents can be reassigned to different roles and responsibilities based on task requirements, performance metrics, or changing circumstances. This flexibility allows the swarm to adapt to different scenarios and optimize performance through intelligent role reallocation. Key features:
  • Dynamic Role Assignment: Agents can switch roles based on task needs
  • Performance-Based Reorganization: Roles adjusted based on agent performance
  • Adaptive Architecture: Swarm structure evolves with changing requirements
  • Flexible Resource Allocation: Optimal use of agent capabilities

Use Cases

  • Dynamic project management with changing requirements
  • Adaptive content creation workflows
  • Performance optimization in multi-agent systems
  • Flexible task allocation based on agent strengths

API Usage

The AgentRearrange swarm type requires the rearrange_flow parameter. It is a string that defines how tasks flow between agents by agent_name: use -> for sequential handoffs and commas for agents that run in parallel within the same step (e.g. "Researcher -> Writer, Editor"). Requests without rearrange_flow are rejected with a 400 error.

Basic AgentRearrange Example

Example Response:

Best Practices

  • Design agents with flexible, transferable skills
  • Use for projects with evolving requirements
  • Ensure agents can adapt to different roles effectively
  • Ideal for dynamic workflows and adaptive systems