Skip to content

Claude API Agent

The claude-api agent calls the Anthropic Claude API directly to generate text responses within your workflow. Unlike the CLI-based claude-code agent, it requires no local binary — just an API key. This makes it ideal for CI/CD pipelines, headless servers, and environments where installing CLI tools isn’t practical.

The agent supports both standard and gate phases. In standard phases it produces a natural-language response based on the role prompt and upstream context. In gate phases it evaluates the pipeline state and produces a verdict (PASS, ROUTE, or ESCALATE).


- name: review
type: gate
agent: claude-api
role: reviewer
depends_on: [implement]

The claude-api agent supports two phase types:

Phase TypeDescription
standardGenerates a text response from the role prompt and upstream handoff context
gateEvaluates pipeline state and produces a verdict: PASS, ROUTE, or ESCALATE
FieldTypeRequiredDescription
namestringYesUnique phase name within the workflow
typestringNo"standard" (default) or "gate"
agentstringYesMust be "claude-api"
rolestringYesRole file name (without .md) from .cliq/roles/
depends_onstring[]NoUpstream phases that must complete before this phase runs
modelstringNoModel override. Default: "claude-sonnet-4-20250514"

The model field is specified on the phase declaration and overrides the default model (claude-sonnet-4-20250514) for that phase only.


Configure under agents.claude-api via cliq settings:

KeyRequiredDefaultDescription
agents.claude-api.api_keyYesAnthropic API key

The claude-api agent produces a minimal handoff envelope with the LLM response as text:

{
"data": null,
"text": "The agent's natural language response and summary of work performed."
}

The data field is always null — all meaningful output is in the text field, which contains the model’s complete response shaped by the role prompt and upstream context.

In gate phases, the agent’s text output is parsed for a verdict:

VerdictMeaning
PASSPipeline continues to the next phase
ROUTEPipeline branches to a specified alternative phase
ESCALATEPipeline halts and requests human intervention

Use Claude as a headless reviewer that gates whether code proceeds to PR creation.

phases:
- name: implement
agent: cursor
role: developer
- name: review
type: gate
agent: claude-api
role: reviewer
depends_on: [implement]
- name: finalize
agent: git
action: create_pr
depends_on: [review]

Example: Multi-model pipeline with Opus upgrade

Section titled “Example: Multi-model pipeline with Opus upgrade”

Use the default Sonnet model for drafting and upgrade to Opus for a critical review step.

phases:
- name: draft
agent: claude-api
role: writer
- name: critique
type: gate
agent: claude-api
role: critic
model: claude-opus-4-20250514
depends_on: [draft]
- name: revise
agent: claude-api
role: writer
depends_on: [critique]

A fully headless pipeline for generating and reviewing documentation — runs anywhere with an API key.

phases:
- name: analyze-code
agent: claude-api
role: analyst
- name: write-docs
agent: claude-api
role: technical-writer
depends_on: [analyze-code]
- name: quality-check
type: gate
agent: claude-api
role: editor
depends_on: [write-docs]

  1. Go to https://console.anthropic.com/settings/keys
  2. Click Create Key and name it (e.g., cliq)
  3. Copy the generated key
Terminal window
echo $ANTHROPIC_API_KEY | cliq settings agents.claude-api.api_key --stdin --global
cliq doctor agent claude-api

cliq doctor agent claude-api checks:

  • agents.claude-api.api_key is configured in settings
  • The API key can authenticate against the Anthropic API