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.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 inCLAUDE.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 callsPOST /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:
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:A complete loop
Related
- Agent runs - the endpoints this loop uses
- API keys - creating and revoking credentials
- Automations - triggers that live in the workspace