Skip to main content
A task is a single unit of work assigned to an agent. It has a title, a description of what needs to be done, and an agent responsible for doing it. Tasks live inside missions and can depend on other tasks.
Task titles must be unique among active tasks. If a task with the same title already exists and is not in a terminal state (done or failed), creation will be rejected. Within a mission, all task titles must be unique.
{
  "title": "Implement auth API",
  "assignTo": "backend",
  "description": "Create JWT-based authentication endpoints.",
  "dependsOn": ["Design schema"],
  "expectations": [
    {
      "type": "llm_review",
      "criteria": "All endpoints return correct status codes. Tests pass."
    }
  ]
}
Tasks can carry expectations (what “done” looks like), dependencies (what must finish first), and assessment criteria (how the output is scored). If you don’t specify expectations, the task completes when the agent finishes without crashing.

Lifecycle

Every task moves through a well-defined set of 7 states:
Task lifecycle state machine: pending → awaiting_approval → assigned → in_progress → review → done or failed, with retry loop

States

StatusDescription
pendingWaiting for dependencies to complete and an agent to be available
awaiting_approvalTask requires approval before it can be assigned; waiting for human or automated approval
assignedAgent selected, runner about to be spawned
in_progressAgent is actively working on the task
reviewAgent finished, assessment in progress
doneTask passed assessment (or assessment skipped)
failedTask failed assessment, agent crashed, or approval was rejected/timed out; may be retried

Phases

Within the in_progress state, tasks move through phases that track the current execution mode:
PhaseDescription
executionInitial run — agent works on the task from scratch
reviewAssessment is evaluating the agent’s work
fixAgent is making targeted corrections based on assessment feedback
clarificationAgent asked a question; Polpo is generating an answer

Fix Phase vs Full Retry

When assessment fails, Polpo first tries a fix phase — sending the agent specific feedback about what’s wrong so it can make targeted corrections without starting over:
Fix phase retry cycle: execution → review → fail → fix → review → fail → fix → review → fail → full retry
  • Fix phase: Agent receives per-dimension scores and feedback. Up to maxFixAttempts (default: 2) before falling back.
  • Full retry: Task resets to pending and starts execution from scratch. Up to maxRetries (default: 3) total.

Transitions

Happy Path

  1. Mission is executed → tasks created as pending
  2. If approval gates are enabled → awaiting_approval → approved → assigned
  3. Otherwise, dependencies met → assigned to agent
  4. Runner spawned → in_progress (phase: execution)
  5. Agent finishes → review (phase: review)
  6. Assessment passes → done

Approval Path

  1. Task moves to awaiting_approval
  2. Human or automated approver reviews the task
  3. Approved → task transitions to assigned
  4. Rejected → task transitions to failed (may be retried)
  5. Timeout → task transitions to failed if autoRejectOnTimeout is enabled

Retry Path

  1. Assessment fails → in_progress (phase: fix)
  2. Agent applies fixes → review
  3. Still failing after maxFixAttemptsfailed
  4. Retries remaining → back to pending (new execution)
  5. No retries left → permanent failed

Side Effects Path

Tasks with sideEffects: true follow a modified retry path to prevent duplicating irreversible actions (emails, API calls, deployments):
  1. Assessment fails → instead of automatic fix/retry, task transitions to awaiting_approval
  2. The task description is updated with failure feedback and a warning not to repeat external actions
  3. Human reviews and decides whether to approve re-execution
  4. Approved → task goes to pending and re-executes with side-effect warnings in the prompt
  5. Rejected → task transitions to failed
Set sideEffects: true when a task uses tools that produce irreversible external effects:
  • email_send, whatsapp_send
  • Non-idempotent HTTP requests (POST, PUT, DELETE)
  • Deployments or external system modifications

Question Path

  1. Agent asks a question during execution → phase becomes clarification
  2. Orchestrator detects question, generates answer
  3. Answer injected, phase returns to execution
  4. Max maxQuestionRounds (default: 2) per task

Deadlock Path

  1. Task is pending but depends on a failed task
  2. Polpo detects deadlock
  3. LLM evaluates: can the blocked task proceed without the dependency?
  4. Absorb: Task proceeds with modified description
  5. Retry: Failed dependency is retried
  6. Unresolvable: Task marked as failed

SLA Deadline Tracking

Tasks and missions can have deadline fields (ISO-8601 timestamps). The SLA monitor tracks these deadlines every tick cycle and emits events:
  • Warning (quality:sla with status: "warning") — when the configured warning threshold is reached (default: 80% of deadline elapsed)
  • Violation (quality:sla with status: "violated") — when the deadline is exceeded

Quality Gates in Missions

Missions can define quality gates that block task progression. When a quality gate is configured at a specific point in a mission, subsequent tasks will not start until all preceding tasks meet the required quality threshold. See Missions for details.

Configuration

{
  "settings": {
    "maxRetries": 3,
    "maxFixAttempts": 2,
    "maxQuestionRounds": 2,
    "maxResolutionAttempts": 2,
    "taskTimeout": 1800000,
    "staleThreshold": 300000
  }
}

Events

Key events during the task lifecycle:
EventWhen
task:createdTask added to registry
task:transitionStatus changes (includes from and to)
agent:spawnedRunner started for task
agent:activityAgent made a tool call or updated progress
assessment:completeAssessment finished with pass/fail result
task:fixFix phase started
task:retryFull retry started
task:retry:blockedAutomatic retry blocked due to sideEffects: true
task:questionAgent asked a question
task:answeredOrchestrator answered the question
task:timeoutTask exceeded maxDuration
approval:requestedTask entered awaiting_approval
approval:resolvedTask approval granted or denied (check status field)
quality:slaSLA warning or violation on a task deadline
All state transitions are atomic — the task registry uses file-based stores (default) with atomic write operations to ensure consistency even if the process crashes mid-transition. SQLite and PostgreSQL are available as alternative stores via @polpo-ai/drizzle.