oi CLI or the HTTP API.
The execution target field
Every work item has anexecution_target field that controls who is expected to do the work:
| Value | Meaning |
|---|---|
human | This item should be done by a person. It does not appear in the agent queue. |
agent | This item should be done by an AI agent. It appears in the agent queue. |
either | Either a human or an agent can execute this item. It appears in the agent queue. |
execution_target to agent or either.
How agents authenticate
Agents authenticate using a Personal Access Token (PAT) withread_write scope. Set the token in your profile or via the OPENINDEX_TOKEN environment variable:
--agent-id flag identifies this agent in queue output, ownership tracking, and audit records. Use a stable, descriptive identifier for each agent deployment.
Workflow agent run tokens — the scoped tokens issued during automated agent dispatch — cannot manage settings. Use a human-owned PAT for any
oi settings ... commands or admin endpoints.How agents discover work
Theoi queue list command returns two buckets:
| Bucket | Contents |
|---|---|
available | Unresolved work items where execution_target is agent or either, and no active agent is assigned |
mine | Unresolved work items where the active agent ID matches your configured agent ID |
The recommended agent workflow
Get agent context
Before claiming an item, inspect its agent context to understand the current goal, allowed exits, blocked exits, and required fields:The underlying API endpoint is
GET /browse/:key/agent-context. In --json mode, the full backend payload is returned — including currentGoal, allowedExits, blockedExits, and requiredFields for the current transition.Claim the item
Claim the work item by transitioning it to an in-progress status. This sets you as the active agent and locks the item from other agents:The underlying API endpoint is
POST /browse/:key/claim.Do the work
Execute the work according to the agent context. Update custom fields as required:Add comments to record progress or collaborate:
Advance stage gates
As you complete each phase, progress through the stage gate to move the item to the next stage:The underlying API endpoint is
POST /browse/:key/stage-gates/:gateKey/progress.One-shot completion
If an item’s stage gates have no outstanding requirements, you can skip the step-by-step progression and complete it in a single command:done auto-progresses through all valid stage gates to the completion stage. Use oi work-item agent-context first to verify there are no blocking requirements.
Agent run tokens
When a workflow stage is marked as requiring agent execution and an assistant provider is configured, OpenIndex can dispatch an agent run automatically. The run is tracked inagentRuns and issued a scoped agentRunToken.
Agent run tokens are intentionally restricted:
- They can perform work item operations (read, update, progress, complete).
- They cannot manage settings, configure workflows, or administer the instance.
- Use a human-owned PAT for all
oi settings ...commands.
Assistant providers
Assistant providers are AI backends configured by instance admins under/admin/ai/providers. They are required for workflow stages marked as agent-required. When work reaches such a stage and no provider is configured, the stage gate cannot be progressed automatically.
Error handling
When a command fails in JSON mode,oi emits a structured error on stderr:
| Error | Resolution |
|---|---|
Status transition is not allowed | Run oi work-item transitions ABC-123 to check valid next statuses. |
Completion status must be terminal | Pass a status from terminalStatuses in the transitions output. |
Stage gate requirements must be acknowledged | Add --accept-requirements-text to your progress command. |
Stage gate checklist is incomplete | Pass each required item with --checked-requirement-item. |
Agent id is required | Set --agent-id in the command or configure it in your profile. |