Running agents headless from scripts and CI
For engineers
Running coding agents without a person at the keyboard: shell scripts, CI pipelines and agent SDKs
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
What is the main difference between an interactive agent session and a headless run?
Check yourself · 2 of 5
Why should a script ask an agent for JSON instead of reading its prose answer?
Check yourself · 3 of 5
Why is an agent in CI exposed to prompt injection?
Check yourself · 4 of 5
When is an agent SDK a better fit than a one-shot CLI call?
Check yourself · 5 of 5
Why set a turn cap on an unattended agent?
Topics
- Non-interactive agent runs from the shell4 min read · Print and exec modes, pre-approved tools, output formats and exit codes for scripted runs
- Getting machine-readable results from agent runs4 min read · JSON and streamed output, schemas for the final answer, and validating results before acting on them
- Coding agents inside CI pipelines5 min read · Agent actions in GitHub Actions and other CI, triggers, token permissions, secrets and untrusted pull-request text
- Building on agent SDKs programmatically4 min read · Claude Agent SDK, Codex SDK and similar: sessions, custom tools and permission callbacks in your own code
- Logging, limits and telemetry for unattended runs4 min read · Turn and budget caps, timeouts, saved transcripts and OpenTelemetry metrics for agents nobody is watching
Start here
- Run Claude Code programmatically (Claude Code docs) (opens in a new tab)DocsFree
Print mode, output formats, JSON schemas, allowed tools and session resume for scripted runs.
- Non-interactive mode (Codex docs) (opens in a new tab)DocsFree
How codex exec runs in scripts and CI, with JSON events, output schemas and sandbox settings.
- Claude Code GitHub Action (repository) (opens in a new tab)ToolFree
A real agent action for GitHub: triggers, inputs and permissions you can read and copy.
Helps to know first
110 questions · last verified 2026-12