Headless Mode
AdaL's headless mode lets you run queries programmatically without the interactive terminal UI. Pass a prompt, get a result — as plain text, structured JSON, or a real-time NDJSON stream. It uses the exact same agent, tools, and capabilities as the interactive CLI.
Use headless mode to integrate AdaL into shell scripts, CI/CD pipelines, editor extensions, or any automation workflow.
Prerequisites
Headless mode requires authentication. Run adal interactively once — your credentials are cached and reused automatically by headless mode.
# Log in interactively first
adal
# Then headless works
adal -q "explain this codebase"
Quick Start
# Simple query — prints the final answer to stdout
adal -q "what does main.py do?"
# Pipe input — reads from stdin when not a TTY
cat bug_report.txt | adal
# JSON output — structured response with metadata
adal -q "list all TODO comments" -o json
# Stream events in real-time as NDJSON
adal -q "refactor the auth module" -o stream-json
# Auto-approve all tool calls (no confirmation prompts)
adal -q "fix the failing test" --yolo
# Use a specific model
adal -q "review this PR" -m claude-sonnet-4-20250514
# Resume a previous conversation
adal -q "now add tests for that" -r <session-id>