Use this when an agent needs to run a computer-use task — software operated through its screen —
through the hosted API or the stateset-computer-use MCP server: previewing, triggering, polling,
retrieving results, using idempotency keys, or working with agent_type templates.
Environment
- API base:
https://api.computer.stateset.app/api/v1
- Auth header on every call:
X-API-Key: $STATESET_CUA_API_KEY
- Never put an API key in a prompt, file, example, log or commit.
Preferred workflow
- Discover allowed task types with
GET /templates, or MCP stateset_cua_list_templates.
- Preview any non-trivial task with
POST /jobs/preview, or MCP stateset_cua_preview_task.
- Trigger with
POST /trigger, or MCP stateset_cua_trigger_task.
- Send an
Idempotency-Key on every trigger. Use a stable key for the same logical task, so a
retry after a timeout does not run it twice.
- For a simple client,
POST /jobs/{job_id}/wait with {"timeout_seconds": 30}. For a
long-running task, poll GET /jobs/{job_id} or consume SSE until status is succeeded,
failed or cancelled.
- Fetch
GET /jobs/{job_id}/result for the summary and artifact pointers.
Trigger payload
Minimum:
Useful optional fields:
model — haiku, sonnet, opus, or a canonical model id
effort — low, medium or high
max_cost_usd — a per-job budget ceiling
tags — up to 20 labels, e.g. ["tenant:acme", "flow:approval"]
output_schema — a JSON Schema the final answer is validated against, caller-side
webhook_url and webhook_secret — a one-shot completion callback
When the stateset-computer-use MCP server is available, prefer its tools over raw HTTP:
stateset_cua_preview_task · stateset_cua_trigger_task · stateset_cua_trigger_batch ·
stateset_cua_get_job · stateset_cua_wait_for_result · stateset_cua_get_result ·
stateset_cua_list_jobs · stateset_cua_list_templates · stateset_cua_get_template
curl
Safety
- Set
max_cost_usd on exploratory or large tasks.
- Preview before any batch submission.
- Never retry without an idempotency key.
- Treat artifact storage keys as pointers; use the dashboard or the authenticated artifact
download endpoints to read them.
Further reading
Last modified on August 31, 2026