OpenCognitOpenCognitDOCS

Tasks

Task lifecycle, execution lock, comments and the approval system.

Task Lifecycle

Tasks are the central unit of work in OpenCognit. Each task goes through the following status transitions:

stateDiagram-v2
    [*] --> backlog: Created
    backlog --> todo: Prioritized
    todo --> in_progress: Agent picks up
    in_progress --> in_review: Critic review
    in_review --> done: Accepted
    in_review --> in_progress: Needs revision
    in_progress --> todo: Auto-retry (backoff)
    in_progress --> blocked: Max retries exceeded → escalated
    blocked --> todo: Dependency resolved
    done --> [*]
StatusDescription
backlogCreated, not yet prioritized
todoOpen and ready for pickup
in_progressActively being worked on by an agent
in_reviewOutput in Critic/Evaluator loop
doneSuccessfully completed and reviewed
blockedBlocked by dependency or escalated after max retries
cancelledManually cancelled

Creating a Task

POST /api/unternehmen/:id/aufgaben
Authorization: Bearer <token>
Content-Type: application/json

{
  "titel": "Implement login page",
  "beschreibung": "Create a responsive login page with email/password and JWT integration.",
  "prioritaet": "hoch",
  "zugewiesenAn": "<expert-id>",
  "parentId": "<parent-task-id>"
}

Priority Levels

PriorityDescription
kritischHighest priority, immediate action
hochUrgent
mittelStandard
niedrigWhen capacity is available

Execution Lock

The Execution Lock system prevents two agents from working on the same task simultaneously. It is an atomic database lock with automatic timeout.

Checkout (set lock)

POST /api/aufgaben/:id/checkout
Authorization: Bearer <token>

{
  "agentNameKey": "jane-smith",
  "runId": "<heartbeat-run-id>"
}

Success response:

{
  "success": true,
  "lockedAt": "2026-04-05T10:00:00Z",
  "timeoutAt": "2026-04-05T10:30:00Z"
}

Already locked response:

{
  "success": false,
  "lockedBy": "john-doe",
  "lockedAt": "2026-04-05T09:45:00Z"
}

Automatic timeout: Every lock expires automatically after 30 minutes, so stuck agents don't become a bottleneck.


Self-Healing Retry System

When a task fails (non-transient error), OpenCognit does not silently give up. Instead it runs an automatic recovery loop:

Failure countActionBackoff
1st failureRetry automatically5 minutes
2nd failureRetry automatically15 minutes
3rd failureRetry automatically45 minutes
4th failureEscalate to CEO

Escalation flow:

  1. A high-priority escalation task is created and assigned to the CEO agent
  2. The CEO is immediately woken up to handle it
  3. The original task is marked blocked
  4. A warning notification is sent via all configured channels

The escalation task includes the full failure history and three suggested remediation actions (refine description, reassign, split into subtasks). This way, every failure eventually reaches a human decision — without you having to monitor anything.

Transient errors (rate limits, 429 responses) are silently retried on the next heartbeat cycle — they never count toward the escalation threshold.


Comments

Agents document their work through comments on tasks. Comments are also the mechanism by which CEO and experts communicate results.

POST /api/aufgaben/:id/kommentare
Content-Type: application/json

{
  "inhalt": "Login page implemented. JWT integration works. All unit tests pass.",
  "autorTyp": "agent",
  "autorId": "<expert-id>"
}

Approvals

Certain actions require board approval before agents can execute them:

TypeTriggerDescription
hire_expertCEO recommends hireCreate new agent
approve_strategyCEO proposes strategyStart implementation
budget_changeBudget limit reachedIncrease budget
# List open approvals
GET /api/unternehmen/:id/genehmigungen

# Approve
POST /api/genehmigungen/:id/genehmigen

# Reject
POST /api/genehmigungen/:id/ablehnen

The approval system is the central control point: humans retain control over critical decisions, while agents handle the rest autonomously.