Running Assignments via API

Overview

The Duvo Public API enables programmatic access to run Assignments from your own applications, scripts, or automation pipelines. Instead of triggering runs through the Duvo web interface, you can integrate Assignments directly into your workflows.

Key Concepts

Assignments (Agents): Assignments are configured through the Duvo web interface with specific instructions, connections, and capabilities. The Public API allows you to trigger runs of these pre-configured assignments.

Runs: A run represents a single execution of an Assignment. When you start a run, the Assignment begins working on its configured task. Runs are asynchronous—the API returns immediately with run information, and you poll for status updates.

Sandboxes: Sandboxes are isolated file environments where you can upload files before starting a run. If your Assignment needs to process files (CSVs, documents, images, etc.), you first upload them to a sandbox, then reference that sandbox when starting the run.

Human-in-the-Loop (HITL): Some Assignments may require human input during execution. When this happens, the run enters a "waiting" status. You can provide a webhook URL when starting a run to receive notifications when human input is needed, then respond via the API.

Base URL

All API endpoints are available at:

https://api.duvo.ai/v1

Rate Limiting

The API enforces rate limits per API key (300 requests per minute). Rate limit information is included in response headers:

Header
Description

x-ratelimit-limit

Maximum requests allowed in the window

x-ratelimit-remaining

Requests remaining in current window

x-ratelimit-reset

Unix timestamp when the window resets

retry-after

Seconds to wait before retrying (when rate limited)

When rate limited, the API returns a 429 Too Many Requests response.


Authentication

All Public API requests require authentication using an API key. API keys are scoped to a team and inherit the permissions of the user who created them.

API Key Format

API keys follow the format dv_<random> (e.g., dv_abc123xyz789...). They are approximately 35 characters long.

Using Your API Key

Include your API key in the Authorization header as a Bearer token:

Creating API Keys in the UI

  1. Navigate to SettingsAPI Keys in the Duvo web interface

  2. Click Create API Key

  3. Enter a descriptive name for the key (e.g., "Production Pipeline", "CI/CD Integration")

  4. Click Create

  5. Copy the key immediately — it will only be shown once and cannot be retrieved later

⚠️ Important: Store your API key securely. Treat it like a password. If you lose it, you'll need to create a new one.

Managing API Keys

From the API Keys settings page, you can:

  • View all keys for your team, including who created them and when they were last used

  • Delete keys that are no longer needed or may have been compromised

Only team Admins and Owners can create and manage API keys.

Key Security

  • Keys are hashed before storage — Duvo cannot retrieve your full key

  • Keys can be revoked at any time by deleting them

  • The last_used_at timestamp helps you identify unused keys

  • Optional expiration can be set when creating keys programmatically


Endpoints

Runs

Start a Run

post

Start a new agent run. Returns immediately with run info - does not wait for completion.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Body
agent_idstring · uuidRequired

The agent ID to run

sandbox_idstringOptional

Optional sandbox ID with pre-uploaded files

webhook_urlstring · uriOptional

Webhook URL to POST events to (human_request, run_completed, run_failed, run_interrupted)

Responses
post
/v1/runs

Get Run Status

get

Get information about an agent run. Can be polled to check status.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
run_idstring · uuidRequired
Responses
chevron-right
200

Default Response

application/json
get
/v1/runs/{run_id}

Get Run Messages

get

Get paginated messages for an agent run. Messages are returned in chronological order.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
run_idstring · uuidRequired
Query parameters
limitinteger · min: 1 · max: 50Optional

Number of messages per page (1-50, default 20)

Default: 20
offsetintegerOptional

Number of messages to skip

Default: 0
Responses
chevron-right
200

Default Response

application/json
totalnumberRequired

Total number of messages for the run

limitnumberRequired

Number of messages per page

offsetnumberRequired

Number of messages skipped

get
/v1/runs/{run_id}/messages

Post a Message to a Run

post

Post a message to an agent run. This will persist the message and resume the agent execution if the run is in a resumable state (waiting, completed, or interrupted).

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
run_idstring · uuidRequired
Body
messagestring · min: 1Required

The message content to send to the agent

Responses
post
/v1/runs/{run_id}/messages

Respond to Human Request

post

Respond to a human-in-the-loop request. Use 'approved' (true/false) for approval-type requests, or 'answers' ({question: answer}) for question-type requests. Only works when the run is in 'waiting' status.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
run_idstring · uuidRequired
request_idstring · uuidRequired
Body
approvedbooleanOptional

For approval-type requests: true to approve, false to deny

Responses
chevron-right
200

Default Response

application/json
post
/v1/runs/{run_id}/human-requests/{request_id}/respond

Stop a Run

post

Stop an agent run. No-op if the run is not currently running.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
run_idstring · uuidRequired
Responses
chevron-right
200

Default Response

application/json
successbooleanRequired
messagestringOptional
post
/v1/runs/{run_id}/stop

Sandboxes

Create a Sandbox

post

Create a new sandbox for file uploads. The sandbox can then be used when starting a run.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Responses
post
/v1/sandboxes

Get Upload URLs for a Sandbox

post

Get a presigned URL for uploading a file to the sandbox. Use this for files larger than 10MB.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
sandbox_idstring · min: 1Required
Body
pathstring · min: 1Required

Path where the file will be uploaded (e.g., /workspace/data.csv)

Responses
chevron-right
200

Default Response

application/json
upload_urlstring · uriRequired
pathstringRequired
expires_in_secondsnumberRequired
post
/v1/sandboxes/{sandbox_id}/upload-urls

Get Files in a Sandbox

get

List files in a sandbox directory.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
sandbox_idstring · min: 1Required
Query parameters
pathstringOptionalDefault: /workspace
Responses
chevron-right
200

Default Response

application/json
get
/v1/sandboxes/{sandbox_id}/files

Upload Files to a Sandbox

post

Upload a file directly to the sandbox. Maximum file size is 10MB. For larger files, use the upload-urls endpoint.

Authorizations
AuthorizationstringRequired

API key authentication. Get your API key from the Duvo dashboard.

Path parameters
sandbox_idstring · min: 1Required
Responses
post
/v1/sandboxes/{sandbox_id}/files

Error Handling

All errors follow a consistent format:

Common HTTP Status Codes

Code
Description

400

Bad Request — Invalid parameters

401

Unauthorized — Missing or invalid API key

403

Forbidden — API key doesn't have access to this resource

404

Not Found — Resource doesn't exist

413

Payload Too Large — File exceeds size limit

429

Too Many Requests — Rate limit exceeded

500

Internal Server Error — Something went wrong on our end

502

Bad Gateway — Upstream service unavailable


Webhooks

Human-in-the-Loop Webhook

When you provide a human_request_webhook_url when starting a run, Duvo will POST to that URL whenever the Assignment needs human input.

Webhook Payload

When you receive this webhook, use the Respond to Human Request endpoint to provide your response and resume the run.


Complete Example

Here's a complete example of uploading files and starting a run:

Last updated