Skip to content

Terminate Swarm

POST
/api/agents/swarm/{swarm_id}/terminate

Terminate an active swarm

Terminates a running swarm by ID. The swarm will be gracefully stopped, all agent members will be released, and the swarm will be moved to the swarm history for future reference. Any in-progress tasks will be cancelled.

@param swarm_id: Unique swarm identifier to terminate @param swarm_engine: Injected swarm execution engine @returns SwarmTerminationResponse with success message @raises HTTPException: If swarm not found (404) or termination fails (500)

Termination Process:

  1. Locate active swarm by ID
  2. Cancel all in-progress tasks
  3. Release all agent members
  4. Move swarm to history with terminated status
  5. Return confirmation message
swarm_id
required
Swarm Id
string

Successful Response

SwarmTerminationResponse

Response model for swarm termination operations.

Provides confirmation message after gracefully terminating an active multi-agent swarm. Indicates successful swarm shutdown with all agent members released and swarm moved to history.

Fields:

  • message: Human-readable confirmation message

Usage: POST /api/swarm/{id}/terminate for swarm lifecycle management.

JSON Example:

{
  "message": "Swarm swarm_abc123 terminated successfully"
}
object
message
required
Message

Termination confirmation message

string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object