Live LabsComing soon10 min

Run Claude Code in Headless Mode

Call Claude Code without the chat window, from a shell script or the Agent SDK, and read its result as JSON.

Out on Monday 19 October10 minutes, one build start to finish

Get it in your inbox the day it is out

One email when the recording is live, then the newsletter. Unsubscribe in one click.

We email you each new issue. You can leave at any time. Privacy

Why this matters

The chat window is one way to use Claude Code. Running it without one, from a script, a scheduled job or your own Python, is how it becomes part of a pipeline. Headless mode with a fixed list of tools and JSON output makes each run repeatable and safe to automate.

What you build

Claude Code running from a script with a prompt, allowed tools and structured output.

  1. Run Claude Code with a prompt from the shell, with no chat window.
  2. Limit what it may do with a list of allowed tools.
  3. Ask for JSON output and read the result in a script.
  4. Call the same run from Python with the Claude Agent SDK.

The ideas behind it

  • Headless runs

    A prompt in, a result out, with no chat window and no one watching.

  • Allowed tools

    A list of the only tools the run may use, so automation cannot wander outside its job.

  • JSON output

    A result your script can parse and act on, rather than text a person has to read.

Before you start

You need
Claude Code installed, and Python for the SDK part.
Length
About 10 minutes, one build start to finish.

Questions

When should I use the Agent SDK instead?

When you want the run inside your own Python program with more control. The lab shows the same run both ways.

Can it edit files on its own?

Only if editing tools are in the allowed list. Leave them out and it can only read.

Where is this useful?

Nightly checks, release notes, code review comments, and any task you would script if a person did it.

Is the recorded lab free?

Yes. Watch it any time, follow the steps and keep the code you build.

How is it different from a Live Lab?

A recorded lab is one short build you follow on your own. A Live Lab builds a bigger part of the system in an hour, with time for your questions.

Then take it further

This build is one piece. The Live Lab Build an AI Mission Control App goes from here to a working part of a real system.

Build the board
Backlog, Needs you, In flight and Done, with each agent's role and tools.
Ask a human first
An agent pauses and asks on Telegram before an action it cannot undo.
Map it to your company
Swap the connectors for the tools your team already uses.

The parts of a production agent system that lab builds, lit on the map:

Week 1Architect
  • Roles and modelsOne job per agent, a model chosen for that job, and a token budget.
  • OrchestrationA queue agents pick work from, with hand-offs a person can follow.
  • Context and memoryRetrieval with sources, memory across sessions, prompts laid out for the cache.
  • Tool callingTyped tools that act in GitHub, Linear and Google.
Week 2Build
  • MCP serversEvery tool behind an MCP gateway, scoped to the role that needs it.
  • Durable executionRuns that resume after a crash and never repeat a write.
  • Human in the loopA person approves anything that cannot be undone.
Week 3Secure and deploy
  • Identity and permissionsEach agent signs in as itself and acts on behalf of a user.
  • LLM gatewayRouting, caching and a budget on every model call.
  • Traces, evals and costEvery run traced, scored and charged to the agent that made it.
  • Multi-tenancyEach team or customer kept apart, in data and in the bill.
Week 4Govern and extend
  • Policy as codeRules checked on every action, not written in a document.
  • Signed skillsNew roles built from reviewed, signed skills.