Agent Integration
Running AI coding agents as workflow steps.
Airlock can invoke AI coding agents as part of a workflow. This lets you use agents to describe diffs, generate review comments, write tests, or perform any task that benefits from AI — all within the same push validation pipeline.
Agent Adapter Configuration
Configure which agent Airlock should use in .airlock/config.yml:
agent:
adapter: claude-codeAvailable Adapters
| Adapter | Agent | Status |
|---|---|---|
claude-code | Anthropic Claude Code | Available |
codex | OpenAI Codex CLI | Coming soon |
opencode | OpenCode | Coming soon |
gemini | Google Gemini CLI | Coming soon |
The adapter tells Airlock how to invoke the agent and capture its output.
Using Agents in Workflows
The airlock exec agent command runs the configured agent with a prompt inside a workflow step:
airlock exec agent "Write a PR title and description for this diff"This invokes the configured agent adapter, passes it the prompt along with the current worktree context, and prints the agent's response to stdout.
To turn that output into something visible in the Push Request, you pipe it into airlock artifact commands.
Structured Output with --output-schema
For steps that need to parse agent output programmatically, pass a JSON schema with --output-schema. The agent's response is guaranteed to match the schema, so you get clean JSON back instead of freeform text.
This is how the built-in describe step works — it asks the agent for a title and body, then feeds them into an artifact:
# Define the expected output shape
SCHEMA='{"type":"object","properties":{"title":{"type":"string"},"body":{"type":"string"}},"required":["title","body"]}'
# Agent returns clean JSON matching the schema
RESPONSE=$(airlock exec agent "Generate a PR title and description for this diff" --output-schema "$SCHEMA")
# Extract fields with `airlock exec json`
TITLE=$(echo "$RESPONSE" | airlock exec json title)
BODY=$(echo "$RESPONSE" | airlock exec json body)
# Produce a content artifact for the Push Request
printf "# %s\n\n%s" "$TITLE" "$BODY" | airlock artifact content --title "Description"The airlock exec json helper extracts a field from JSON input — useful for piping structured agent output into artifact commands.
What the Agent Has Access To
When airlock exec agent runs, the agent operates in the checked-out worktree with full access to:
- The repository source code
- The diff between
AIRLOCK_BASE_SHAandAIRLOCK_HEAD_SHA - All environment variables available to workflow steps
- The
airlock artifactcommands for producing content, comments, and patches
Agent adapters are optional. The default workflow uses built-in steps that don't require an agent. Configure an adapter when you want an AI agent to participate in the validation workflow itself.
Related
- Workflows — Define what runs on each push
- Custom Steps — Write steps that invoke agents or other tools
- Artifacts — How agent output becomes content, comments, and patches