Run it without you: unattended runs, cost and handover

Day 7, 30 minutes · advanced

Goal of this lessonRun a fixed task with nobody at the keyboard, put a limit on its cost and its permissions, and write the runbook that someone else needs to run it alone.

Why it matters

The job is done when the client runs it without you, not when it works on your laptop. Until now every run of orderdesk started with you at the keyboard. You typed the prompt, you approved the steps, you read the result. Today Tomas, Kettlebrook's own engineer, takes the repository over. He needs a run that starts from a script, does only what it is allowed to do, and tells him what it cost.

That means three things to settle before you leave. Where the run lives and what it may touch. What one run costs and where a budget stops it. And a runbook short enough that someone else can follow it cold, without calling you.

At the end of this lesson the day 6 eval (the fixed set of test cases that scores every draft) runs with nobody at the keyboard and writes its result to a file. You have noted the cost of one run, set a budget, written a one-page runbook, and restarted the run from that runbook in a fresh terminal.

Two ways to run without a chat window

Headless is the everyday word for an agent started from a script or a pipeline, with no chat window. In this course we call it an unattended run. You give the tool one prompt and a set of permissions. It works through the agent loop on its own and exits with a code your script can check.

The second route is an agent SDK: the same loop as a library inside the client's own software. The client's code calls the agent, passes it the task and the permissions, and reads the result, much as it would call any other library. It fits when the agent is one step inside a larger product. For one fixed job on a schedule, a script is easier to read and to hand over, so this lesson uses a script.

Where it runs

Pick the place before you write the command:

  • a pipeline job, when the run belongs to a change in the repository
  • a scheduled job, when it runs at a fixed time
  • a small service, when the client's software starts it

Wherever it runs, apply your security list from day 5: least privilege, no secrets in logs, a person approves every write, and a record of every action. Credentials come from the environment or the job's secret store, never from the script or the repository.

Keep the run narrow for one more reason. It reads the drafts in evals/drafts/, and text an agent reads can try to give it orders (prompt injection). A run that may write only one file can do little harm when that happens.

The steps

  1. Write the script. In orderdesk/, create run_eval.sh (on Windows, run_eval.ps1). It starts your agent with this one task:
Run python evals/run.py. Write the pass rate and the ids of the failing cases to evals/last_run.md. Change no other file.

This task is small on purpose. evals/run.py calls no model, so a plain scheduled job could run it without an agent. We use it because it is a safe way to practise what every unattended run needs: narrow permissions, a result you can check and a known cost. On a real job the run you hand over does the model work itself. It drafts the replies, through the client's own model call or through an agent started the way you start this one, and this eval is the check that runs after it.

  1. Limit the run to three things: run that one command, read files in the repository, write evals/last_run.md. Get as close to that as your tool's flags allow. Where the tool only offers a limit for the whole workspace, write that down. It is a finding for the client, not a mistake of yours.
  2. Run it with nobody at the keyboard. Start the script and do not touch the terminal until it exits. A run that stops to wait for an answer is not unattended yet.
  3. Check the evidence: the exit code, the content of evals/last_run.md, and git status. The agent should have changed that one file and nothing else, apart from the output file your script itself writes.
  4. Note the cost of one run, set a budget, and write RUNBOOK.md. The sections below say how.
  5. Test the runbook cold.

Pick your tool below for the exact commands.

What one run costs

Four things drive the cost: the text that goes in (instructions, files read, command output), the text that comes out, how often it runs, and which model does the work. A run every weekday is about twenty runs a month, so measure one run and multiply.

A token is a small piece of text. Models count and bill their input and output in tokens. The tools report cost in different units. Some give an estimated money figure, some give token counts, some give credits on an account page, and some give nothing per run. Write down what yours reports and where you read it. Do not turn tokens into money with a rate you guessed. Take the rate from the client's own price list or contract.

Budget and alert

Set two limits where your tool has them. A cap per run, so one run that loops cannot run away. A limit on the account, so a schedule that runs too often stops. Add an alert if the tool or the billing page offers one. Where there is no alert, say so in the runbook and name who checks the usage page, and how often.

The runbook

Keep RUNBOOK.md to one page, with these headings:

Start
Stop
Update
What a failure looks like
Acceptance test (the day 6 eval)
Cost of one run and the budget
Owner (Tomas)
  • Start: the exact command, and the environment variables it needs, by name only.
  • Stop: how to cancel a run that is going, and how to switch off the schedule.
  • Update: how to update the tool, and that the eval runs again after every update.
  • What a failure looks like: a non-zero exit code, a missing or old evals/last_run.md, a run that waits for an answer, a pass rate lower than the last one.
  • Acceptance test: the day 6 eval. A change to the prompt or the tool is accepted when the pass rate does not drop.
  • Cost of one run and the budget: your figure, its unit, where it came from, and the limits you set.
  • Owner: Tomas, by name. A runbook without an owner belongs to nobody.

If the page is not enough, the solution is too complicated to hand over yet.

Test it cold

Open a fresh terminal with no shell history, or ask a colleague. Follow only what the runbook says and restart the run. Every time you reach for something that is not written down, add it to the runbook and start again. On a real job, also do the exit test: a client engineer runs it, breaks it and fixes it while you only watch.

In a chat tool

The four chat products have a scheduled feature, though not every one is offered in the Netherlands, and none was shown to run a script in a repository. So in a chat product you build the reporting end. Schedule this prompt with the latest result pasted under it, note what the schedule may and may not do, and use the coding tool tab of the same vendor for the run itself:

Every weekday at 8:00, read the eval result I saved and write a three-line summary: the pass rate, the failing cases, what changed since the last run. Do not send anything.

How the tools compare

  • Claude Code: non-interactive mode, with a permission mode, allow rules per command and per file, a turn cap and a cost cap. The JSON output carries an estimated cost.
  • OpenAI Codex: non-interactive mode (codex exec) with a sandbox for the whole workspace. Token counts in the JSON events, no per-run budget flag.
  • Gemini CLI: headless mode, with token counts in the JSON stats. No money figure and no spending cap found.
  • Cursor: print mode of the Cursor CLI, with a project permission file. No cost field in the output, usage on the dashboard.
  • GitHub Copilot CLI: programmatic mode with allow rules and a soft cap in AI credits. Usage on the billing page.

Deeper dive

Today's actions

Ticks are not saved without an account

Do it in your tool

Claude

  1. Paste the prompt below in a Claude conversation and paste the text of your latest evals/last_run.md (or evals/scores.md from day 6) under its last line. Answer Claude's questions, review the proposed task name, schedule and instructions, and click Schedule.
    Every weekday at 8:00, read the eval result I saved and write a three-line summary: the pass rate, the failing cases, what changed since the last run. Do not send anything.
    
    The eval result I saved (pasted from evals/last_run.md or evals/scores.md):
  2. Click Scheduled in the left sidebar instead if your screen still shows separate Chat and Cowork options (Cowork is Claude for agentic work beyond coding). Then click New task, choose Set up manually, fill in the name, prompt, approval mode and frequency on weekdays, and click Save.
  3. Click Scheduled in the left sidebar and run the task once on demand. Check that the summary names the pass rate and the failing cases from the text you pasted. When a new result lands, edit the task's instructions there and paste the new text.
  4. Write down what the task may use: your connected tools, skills, plugins, web research and saved files. Switch off connectors it does not need, and set any connector tool that can write to Always ask.
  5. Use the Claude Code tab of this lesson for the run itself (the eval script, the result file and a cost cap). There claude -p runs Claude Code with no chat window and exits with code 0 on success.

Note: We found no page that shows a chat scheduled task running a repository's eval script, and no steps for saving a file to your Claude account, so the result goes in the prompt. A tool set to Always ask can leave a run waiting for your answer, or the run finishes without it. Scheduled tasks run remotely, also while your computer sleeps. Chat usage shows under Settings > Usage. We found no per-run cost report or budget alert in chat. An admin controls access with the Cowork admin toggle.

Paid planScheduled tasks are on all paid plans (Pro, Max, Ultra, Team and Enterprise), not on Free. On web and mobile, Team is in beta and Enterprise needs an owner to switch it on.

Checked on 28 November 2026 · Source: Claude Help Center: Schedule recurring tasks (opens in a new tab)

Create a free account to save your progress. Sign in or sign up