Skip to content

Headless CLI

gdc print executes an agent task with streaming replies and tools.

The basics

gdc print "list the source files and summarise the project"
Stream Contents
stdout Assistant reply
stderr Progress, tool activity and optional reasoning

Capture the reply with gdc print "<task>" > answer.txt.

Approvals in headless runs

Requests classified as ask are denied by default. Use --auto-approve for an unattended run that should allow them:

gdc print --auto-approve "run the tests and fix failures"

Explicit denials remain in force. To save approvals for later runs:

gdc print --auto-approve --auto-approve-remember "<task>"
gdc permissions list
gdc permissions revoke --all

See Permissions.

Continuing a session

gdc print --session-id <id> --resume "add tests for that change"

Without --resume, the id appends to the existing log without loading it into the current conversation.

Choosing a profile and style

gdc print --profile plan "plan the caching layer"
gdc print --output-style concise "explain this build failure"

See Profiles and styles.

Useful controls

Flag Effect
--max-iterations N Limit agent iterations; default 16
--timeout-secs N Model-request timeout; default 300
--max-tokens N Maximum reply tokens
--temperature F Sampling temperature
--reasoning LEVEL Reasoning effort; default medium
--show-reasoning Stream reasoning to stderr
--system TEXT Override system instructions
--repair-empty-turn Re-prompt after an empty local-model turn

See CLI reference for all flags.

A quick connectivity check

gdc chat "say hello"

Checks the model without tools or a saved session.

Example: a CI step

#!/usr/bin/env bash
set -euo pipefail
export GDC_BASE_URL="http://localhost:8000/v1"
export GDC_MODEL="loaded-model"
gdc print --auto-approve --output-style concise \
  "run the linter and fix warnings"

Inspect the saved run with gdc sessions show <id>.