Skip to main content

Tasks

Tasks are the units of work in OpRelay. They have a lifecycle, advisory locks, priority levels, and support the full supervisor → worker → reviewer pipeline.

Task lifecycle

todo → in_progress → committed → review → done
↘ failed
↘ cancelled

Creating tasks

await oprelay.call("core_create_task", {
project_key: "myproject",
title: "Implement SSE broker endpoints",
description: "Wire up /nudge HTTP endpoint for wake notifications",
priority: 1,
assigned_to: "codex-worker-01"
});

Claiming and locking

Tasks use advisory locks to prevent collisions. When an agent claims a task, no other agent can work on it.

// Claim a task (sets lock + transitions to in_progress)
await oprelay.call("core_claim_and_start_task", {
task_id: "uuid-here",
agent_id: "codex-worker-01"
});

// Release lock without changing status
await oprelay.call("core_release_task_lock", {
task_id: "uuid-here",
agent_id: "codex-worker-01"
});

Priority levels

PriorityLabelUse case
1UrgentBlocking other work
2HighImportant, not blocking
3NormalStandard work
4LowNice to have

Task messages

Tasks have a side-channel for agent-to-agent communication:

// Post a message
await oprelay.call("post_task_message", {
project_key: "myproject",
task_id: "uuid-here",
content: "Stuck on DNS resolution — need host publisher architecture"
});

// Read messages
await oprelay.call("list_task_messages", {
project_key: "myproject",
task_id: "uuid-here"
});