Webinar: Better Agents, Easier than Ever — Thursday, June 18th at 9am PT / 12pm ET. Register Now
Version 2.5
Work items

Work items

Work Items are the unit of work a Worker agent processes. Use this API to queue work, track it through its lifecycle, attach files, and drive review and retries.

All paths are relative to the base URL and require an Authorization: Bearer YOUR_API_KEY header.

The Work Item object

Returned by create, get, continue, and restart.

FieldTypeDescription
work_item_idstringUnique identifier.
agent_idstringAgent that will process the item.
statusWorkItemStatusCurrent status (see below).
thread_idstringThread for this item (null until created).
payloadobjectArbitrary input data for the agent.
messagesarray<ThreadMessage>Conversation messages on the item.
initial_messagesarray<ThreadMessage>The messages the item started with.
callbacksarray<WorkItemCallback>Status-change callbacks.
work_item_namestringUser-friendly name (max 255 chars).
work_item_urlstringLink to the item in the application.
created_bystringUser who created the item.
completed_byAGENT | HUMANWho completed it.
status_updated_bySYSTEM | AGENT | HUMANWho last changed status.
created_at / updated_at / status_updated_atstringTimestamps.

Status reference

WorkItemStatus is one of:

StatusMeaning
DRAFTCreated but not yet submitted for processing.
PENDINGQueued, waiting to be picked up.
EXECUTINGThe agent is working on it.
NEEDS_REVIEWThe agent paused and needs a human decision (see below).
COMPLETEDFinished successfully.
ERRORFailed.
CANCELLEDCancelled before completion.
INDETERMINATEState could not be determined.

Status drives what you can do. File uploads require DRAFT — a newly created item is PENDING, so it must be in draft to attach files. Lifecycle actions (continue / restart / cancel / complete) are only valid from certain statuses; an illegal transition returns 412 Precondition Failed (e.g. "Cannot continue work item from status PENDING").

Create a work item

POST /work-items

Queues a new work item for an agent.

Body

FieldTypeRequiredDescription
agent_idstringYesAgent that will process the item.
payloadobjectNoInput data for the agent.
messagesarray<ThreadMessage>NoSeed messages for the item's conversation.
work_item_namestringNoUser-friendly name (max 255 chars).
work_item_idstringNoUse a specific ID (e.g. one returned by an earlier file upload).
callbacksarray<WorkItemCallback>NoCallbacks to fire on status changes.

Request

curl -X POST 'https://{your-deployment-host}/tenants/{tenant-id}/api/v2/work-items' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "agent_id": "AGENT_ID",
    "work_item_name": "Invoice 4815",
    "payload": { "invoice_number": "4815", "amount": 1620.00 }
  }'

Returns the created Work Item.

List work items

GET /work-items

Parameters

ParameterInTypeRequiredDescription
agent_idquerystringNoFilter by agent.
work_item_statusqueryarray<WorkItemStatus>NoFilter by status (repeat for multiple).
created_byquerystringNoFilter by the creating user.
name_searchquerystringNoSearch within the work item name.
limitqueryintegerNoPage size.
offsetqueryintegerNoOffset to start from.

ResponseWorkItemsListResponse

{ "records": [ /* WorkItem objects */ ], "next_offset": 50 }

Use next_offset as the offset for the next page.

Get a work item

GET /work-items/{work_item_id}

ParameterInTypeRequiredDescription
work_item_idpathstringYesWork item ID.
resultsquerybooleanNoInclude the item's results.

Returns a Work Item.

Attach files

Upload a file first, then either create the work item with the returned ID or confirm the upload onto an existing item.

Upload a file

POST /work-items/upload-file

Send as multipart/form-data with a file field. If you don't pass work_item_id, a new item ID is created and returned.

A target work item must be in DRAFT state to accept files. Uploading to a PENDING item (the state a new item lands in) returns 400. To attach files to an existing item, it has to be a draft.

ParameterInTypeRequiredDescription
work_item_idquerystringNoAttach to an existing item; omit to create.
fileformbinaryYesThe file to upload.
curl -X POST 'https://{your-deployment-host}/tenants/{tenant-id}/api/v2/work-items/upload-file' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'file=@invoice.pdf'

Confirm a file

POST /work-items/{work_item_id}/confirm-file

Confirms a remote file upload onto a work item.

FieldTypeRequiredDescription
file_refstringYesReference of the upload.
file_idstringYesID of the uploaded file.

Lifecycle actions

Continue

POST /work-items/{work_item_id}/continue

Continues a work item — for example after a NEEDS_REVIEW decision. Returns the updated Work Item.

Restart

POST /work-items/{work_item_id}/restart

Restarts processing of a work item. Returns the updated Work Item.

Cancel

POST /work-items/{work_item_id}/cancel

Cancels a work item.

Complete

POST /work-items/{work_item_id}/complete

Administratively marks a work item as COMPLETED — for example when a human reviewer resolves a NEEDS_REVIEW item without further agent work.

Handling NEEDS_REVIEW. When an item is NEEDS_REVIEW, read it with GET /work-items/{id} to see why. Then either complete it (the human decision is enough) or restart/continue it (let the agent try again with new input).

Delete

Delete one

DELETE /work-items/{work_item_id}

Deletes a work item and cleans up associated resources.

ResponseDeleteWorkItemResponse

{ "work_item_id": "string", "status": "string", "warnings": [] }

Batch delete

POST /work-items/delete

Deletes multiple work items in one call.

Body

{ "work_item_ids": ["id1", "id2"] }

ResponseDeleteWorkItemsResponse

{ "deleted": 2, "failures": 0 }

Callbacks

A work item can carry callbacks that fire when it reaches a given status (default NEEDS_REVIEW). The platform POSTs to your URL when the status is reached.

Field (WorkItemCallback)TypeDescription
urlstringURL to POST to when the status is reached.
on_statusstringStatus that triggers the callback (default NEEDS_REVIEW).
signature_secretstringOptional secret used to sign the payload; omit to leave it unsigned.