Skip to content

Gemini API Agent

The gemini-api agent calls the Google Gemini API directly to generate text responses within your workflow. Unlike the CLI-based gemini 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: summarize
agent: gemini-api
role: analyst
model: gemini-2.5-pro
depends_on: [fetch-data]

The gemini-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 "gemini-api"
rolestringYesRole file name (without .md) from .cliq/roles/
depends_onstring[]NoUpstream phases that must complete before this phase runs
modelstringNoModel override. Default: "gemini-2.5-flash"

The model field is specified on the phase declaration and overrides the default model (gemini-2.5-flash) for that phase only.


Configure under agents.gemini-api via cliq settings:

KeyRequiredDefaultDescription
agents.gemini-api.api_keyYesGoogle Gemini API key

The gemini-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

Run a headless summarization step after an implementation phase — no CLI tooling required on the build agent.

phases:
- name: implement
agent: cursor
role: developer
- name: summarize
agent: gemini-api
role: summarizer
depends_on: [implement]

Use a more capable model for a quality gate that decides whether code passes review.

phases:
- name: implement
agent: cursor
role: developer
- name: quality-gate
type: gate
agent: gemini-api
role: reviewer
model: gemini-2.5-pro
depends_on: [implement]
- name: finalize
agent: git
action: create_pr
depends_on: [quality-gate]

A fully headless pipeline suitable for GitHub Actions or similar — no local binaries needed.

phases:
- name: analyze
agent: gemini-api
role: analyst
- name: draft-response
agent: gemini-api
role: writer
depends_on: [analyze]
- name: review
type: gate
agent: gemini-api
role: reviewer
depends_on: [draft-response]

  1. Go to https://aistudio.google.com/apikey
  2. Click Create API key and select your Google Cloud project
  3. Copy the generated key
Terminal window
echo $GOOGLE_API_KEY | cliq settings agents.gemini-api.api_key --stdin --global
cliq doctor agent gemini-api

cliq doctor agent gemini-api checks:

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