Skip to main content
OpenIndex is built with agent execution as a first-class capability. AI agents can discover available work, claim it, progress through workflow stage gates, and complete it — all through the oi CLI or the HTTP API.

The execution target field

Every work item has an execution_target field that controls who is expected to do the work: When you create a work item you intend for agents to execute, set execution_target to agent or either.

How agents authenticate

Agents authenticate using a Personal Access Token (PAT) with read_write scope. Set the token in your profile or via the OPENINDEX_TOKEN environment variable:
The --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

The oi queue list command returns two buckets:
In JSON mode (useful for pipelines):
You can filter by domain:
1

List the queue

Pull the queue to find available work:
Choose an item from the available bucket.
2

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.
3

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.
4

Do the work

Execute the work according to the agent context. Update custom fields as required:
Add comments to record progress or collaborate:
5

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.
6

Complete the item

Once all stage gates are satisfied, complete the item with a terminal status:
The underlying API endpoint is POST /browse/:key/complete. Completing an item clears the active agent fields and marks the item as resolved.

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 in agentRuns 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.
A human can always override agent execution. If an agent is stuck, a domain admin or the item owner can manually advance the status, reassign the item, or clear the active agent with oi work-item update ABC-123 --clear-agent.

Error handling

When a command fails in JSON mode, oi emits a structured error on stderr:
Common issues and their resolutions: