Skip to content
Lesson 10 of 1191% of the course

Run Claude Code unattended: headless, scheduled, sandboxed

Build a headless Claude Code command that will not stall, schedule runs with a cron expression you can check, cap what they spend, and confine them with the sandbox, all in Config Studio for Claude Code.

Video coming soonRun Claude Code unattended: headless, scheduled, sandboxedUntil then, the lesson below walks through every step.

Running Claude Code with nobody watching (in CI, from a script, on a timer) is a different job from using it at your desk. A question nobody answers makes the run hang. A schedule with a typo runs a hundred times more often than you meant, and every run costs money. This lesson builds unattended runs in Config Studio for Claude Code that finish, stay cheap and stay contained.

Build a headless command

Open Headless runs. A headless run is one prompt in and an answer out, with no conversation. The fields:

  • The prompt: what it should do, like review the diff and report
  • What comes back: text for a person, json for one object a script reads, stream-json for one object per line as it goes
  • What it may do unattended: the permission mode
  • Tools it may use and Tools it may not
  • Stop after this many dollars: a spend cap
  • Added to the system prompt: extra instructions for this run only

The preview shows the whole command, every flag written out, so nothing is left to a default you did not choose.

Make sure it will not stall

The most common failure is a mode that asks. With nobody there, the first question hangs the run forever.

Open Try it and pick Would this run unattended? Give it the prompt, the permission mode, the spend cap and the output. It warns about combinations that look fine and stall, and about a run with no spend cap. When everything is right it answers schedulable: bounded, unattended, and nothing asks.

A safe pattern for a review job: permission mode plan (it reads and reasons, changes nothing), a small allowed tool list like Read and Grep, and a spend cap.

Schedule it and check the schedule

Open Scheduled runs. A scheduled run is a headless run with a timer in front of it:

  • Name: the file name, and what you type to stop it
  • When: a cron expression of five fields (minute, hour, day of month, month, day of week)
  • What it runs: the prompt

Cron accepts almost anything and then runs on a schedule you did not mean. Three checks in Try it catch that:

CheckWhat it answers
What does this expression say?The schedule in words, like "at minutes */15 of hours 9-17, Monday to Friday"
When does this fire?The next six times it will run
How often is that, before I find out?Runs per month, like "every 5 minutes, about 8,640 a month"
Every 5 minutes is about 8,640 runs a month.

Always run the third one. The difference between a good expression and a typo is two orders of magnitude in cost.

Confine it with the sandbox

Open Sandbox. It confines what Claude Code can reach on the filesystem and the network, and its keys are shown together because the two halves affect each other. Only what you set is written.

Two things to know:

  • A sandbox that cannot start on your machine protects nothing. Use This machine first, so the studio tells you whether it will work there
  • bypassPermissions (nothing asks) belongs only inside a sandbox with no network

Start from the CI profile

The Profile: unattended and CI starter pack sets up this whole posture at once, for a run where a prompt would just hang. Apply it, then adjust the rules to your job.

Know what a run cost

After runs, open What did that session cost? in Try it and pick a transcript from ~/.claude/projects. It shows the tokens, the models and the money, read in your browser and not uploaded. Sessions and transcripts sets how long those files are kept.

The last lesson brings it all together: reviewing a plan, installing it safely and sharing it with a team.

Your progress stays in this browser only.
Contact