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:
- Locate active swarm by ID
- Cancel all in-progress tasks
- Release all agent members
- Move swarm to history with terminated status
- Return confirmation message
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Responses
Section titled “ Responses ”Successful Response
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
Termination confirmation message
Validation Error