Skip to main content
Interactive runs forgive a lot - a person is there to notice. Unattended runs need the failure modes handled up front: the right identity, bounded permissions, a schedule, and a way out when something needs a human.

Use a service account, not your key

A user-owned API key acts as you, with everything you can reach. A service-account key acts as its own identity, so you grant it exactly the workspaces the job needs and revoking it changes nothing else.
Check what a key actually is before you deploy it:
Two things behave differently for service-account keys:
  • POST /api/workspaces returns 403. Create the workspace under the organization instead, with POST /api/organizations/{orgId}/workspaces.
  • The automation endpoints require a user principal, so a service-account key gets 403 there. Use a user-owned key for those, or deploy the automation once and let its trigger run it.
See API keys for the permissions that govern creating each kind.

Bound the run

An unattended run should be able to do its job and nothing more.

Give it durable instructions

Anything you would have said in a follow-up message belongs in the workspace, because there is no follow-up message. Put the conventions in CLAUDE.md and the procedure in a skill - see Skills and subagents. A scheduled run that reads its own instructions from the workspace is also a run you can fix by editing a file, without redeploying anything.

Run it on a schedule

Two options, depending on where you want the schedule to live. Your scheduler. A cron job, a CI schedule, or a queue worker calls POST /api/agent/message and polls to completion. You own retries and alerting. An automation in the workspace. An .automation file carries its own trigger - a schedule, an inbound webhook, or a file landing in a folder - and runs server-side with nothing of yours hosting it. Deploy it once:
Saving the file is not enough - triggers register on deploy. Pause, resume, or remove them later with the deployment endpoints. See Automations for what an automation can do between trigger and finish.

Tell a human when it matters

A run that fails quietly at 3am is the whole problem. Notify someone in your organization from the job itself:
Agents can send these themselves during a run, so “if you cannot finish, notify ops” is a legitimate instruction to put in a skill.

A complete loop