Missions

Multi-agent mission orchestration — list, inspect, redirect agents, spawn agents, and cancel subtasks.

Overview

Missions are multi-agent execution plans created when the system classifies a query as COMPLEX. Each mission contains a DAG of subtasks (agents) that execute in dependency order, with parallel execution within each layer.

See the Missions guide for a conceptual overview.


Data Models

Mission

FieldTypeDescription
idUUIDUnique mission identifier
workspace_idUUIDOwner workspace
conversation_idUUIDOriginating conversation
user_idUUIDCreator
titlestringFirst 500 chars of the original prompt
statusstringpending running completed failed partially_failed cancelled
dag_definitionobjectSubtask DAG structure
agent_countintegerTotal number of subtasks
parallel_countintegerMaximum agents running concurrently
original_promptstringFull user query
completion_summarystring|nullAI-generated synthesis of all results
overall_rqsfloat|nullAggregate quality score (0–1)
overall_creditsnumberTotal credits consumed across all subtasks
total_duration_msinteger|nullWall-clock execution time
started_atdatetime|nullWhen execution began
completed_atdatetime|nullWhen execution finished
created_atdatetimeProposal timestamp
updated_atdatetimeLast state change
subtasksMissionSubTask[]Ordered list of all subtasks

MissionSubTask

FieldTypeDescription
idUUIDSubtask identifier
mission_idUUIDParent mission
subtask_indexinteger0-based execution order
titlestringAgent name / role
workflow_typestringsynthesis recommendation drafting chat full_pipeline
promptstringCurrent prompt (may be updated by redirect)
depends_oninteger[]Indices of prerequisite subtasks
statusstringpending running completed failed cancelled redirected
agent_namestring|nullHuman-readable agent identifier
artifact_summarystring|nullDescription of outputs created
artifact_countsobject|null{"insights": 3, "documents": 1, ...}
quality_scorefloat|nullPer-agent verifier score (0–1)
credits_consumednumberCredits billed for this agent
redirect_countintegerNumber of times prompt was redirected
redirect_historyarray|null[{at, from_prompt, to_prompt}]
started_atdatetime|nullAgent start time
completed_atdatetime|nullAgent completion time

Endpoints

List Missions

GET/api/missions

List missions for a workspace, with optional status filter and pagination.

Query Parameters:

ParameterTypeRequiredDescription
workspace_idUUIDYesWorkspace to query
statusstringNoFilter by status (e.g. running)
limitintegerNoPage size (default 20, max 100)
offsetintegerNoPagination offset (default 0)

Response (200):

{
  "missions": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "workspace_id": "...",
      "conversation_id": "...",
      "title": "Analyze Q4 user interview data and build a feature prioritization PRD",
      "status": "completed",
      "agent_count": 4,
      "parallel_count": 2,
      "overall_rqs": 0.84,
      "overall_credits": 12.5,
      "total_duration_ms": 87400,
      "started_at": "2026-04-03T10:00:00Z",
      "completed_at": "2026-04-03T10:01:27Z",
      "created_at": "2026-04-03T09:59:58Z",
      "subtasks": [...]
    }
  ],
  "total": 47
}

Get Mission

GET/api/missions/{mission_id}

Fetch a single mission with its full subtask list.

Response (200): Full Mission object including subtasks array.

Errors:

CodeCondition
404Mission not found or user not a workspace member

Redirect Subtask

POST/api/missions/{mission_id}/subtasks/{subtask_index}/redirect

Update a running agent's prompt in real-time without stopping the mission.

Request Body:

{
  "newPrompt": "Focus specifically on enterprise pricing pain points, ignore SMB data"
}

Response (200): Updated MissionSubTask with incremented redirect_count and appended redirect_history entry.

Errors:

CodeCondition
400Subtask is not in running status
404Mission or subtask not found

Redirects take effect at the next execution checkpoint within the running agent. The agent may not respond instantaneously if it is mid-tool-call.


Spawn Agent

POST/api/missions/{mission_id}/agents

Add a new agent to a running or pending mission.

Request Body:

FieldTypeRequiredDescription
titlestringYesAgent name (e.g. "Check G2 reviews")
promptstringYesWhat this agent should do
workflow_typestringNoDefault: "chat"
dependsOninteger[]NoSubtask indices that must complete first

Response (201): New MissionSubTask with status: "pending".

Errors:

CodeCondition
400Mission is not in running or pending status

Cancel Subtask

DELETE/api/missions/{mission_id}/subtasks/{subtask_index}

Cancel a pending or running subtask. Dependent subtasks will not execute.

Response (200): Updated MissionSubTask with status: "cancelled".

Errors:

CodeCondition
400Subtask is already completed, failed, or cancelled
404Mission or subtask not found

SSE Events

Mission progress is delivered over the chat stream (see Streaming SSE).

mission_proposed

Emitted when a complex query has been decomposed. Displayed as the Mission Proposal card.

{
  "event": "mission_proposed",
  "data": {
    "mission_id": "uuid",
    "subtasks": [
      {
        "index": 0,
        "title": "Research market trends",
        "workflow_type": "synthesis",
        "depends_on": []
      },
      {
        "index": 1,
        "title": "Generate recommendations",
        "workflow_type": "recommendation",
        "depends_on": [0]
      }
    ],
    "agent_count": 2,
    "parallel_count": 1
  }
}

agent_thread_start

Emitted when a subtask begins execution.

{
  "event": "agent_thread_start",
  "data": {
    "mission_id": "uuid",
    "subtask_index": 0,
    "agent_name": "Research market trends",
    "workflow_type": "synthesis"
  }
}

agent_thread_done

Emitted when a subtask completes.

{
  "event": "agent_thread_done",
  "data": {
    "mission_id": "uuid",
    "subtask_index": 0,
    "artifact_summary": "Created 4 insights on market positioning",
    "artifact_counts": {
      "insights": 4,
      "documents": 1
    },
    "duration_ms": 34200
  }
}

done (with mission_id)

The final done event includes the mission_id when a mission has completed:

{
  "message_id": "uuid",
  "summary": "Mission complete: 4 agents, 12 artifacts",
  "model": "claude-sonnet-4-20250514",
  "mission_id": "uuid",
  "num_turns": 16,
  "duration_ms": 87400,
  "credits": 12.5
}

Mission Events Log

Each state change creates an immutable MissionEvent record:

Event TypeTrigger
proposedMission decomposed
launchedUser clicks Launch
agent_startedSubtask begins execution
agent_completedSubtask finishes
agent_redirectedSubtask prompt updated
agent_stoppedSubtask cancelled
agent_spawnedNew subtask added
mission_completedAll subtasks done
mission_failedExecution error
mission_cancelledUser cancelled

Was this helpful?