Run agents in a pipeline

Buddy pipelines can run an AI coding agent as a build action, so you can automate agent work on events - open a pull request and have an agent review it, forward an email and have an agent act on it, or kick off an agent whenever a new error shows up in Sentry.

An agent action runs inside the pipeline with access to everything the pipeline has: your code, artifacts, environment variables, integrations, and the filesystem - the same context as any other action.

Available agents

Available as pipeline actions today:

  • Claude Code
  • Antigravity

Coming soon:

  • Codex
  • Cursor
  • OpenCode
  • Grok Build
Info
Beyond the built-in agent actions, you can add a sandbox action to a pipeline and drive the agents pre-installed there with your own commands - which gives you virtually unlimited flexibility. See Run agents in a sandbox.

What you can automate

  • Pull request review - trigger on an opened PR and have the agent review the diff and leave comments.
  • PR descriptions - when a PR is created, have the agent summarize the branch's changes and write them into the pull request description.
  • Release notes & blog posts - generate a changelog or a blog article straight from a changeset, grouping new features, improvements, and bugfixes.
  • Email-driven tasks - forward an email to the pipeline and let the agent act on the request.
  • Sentry issues - run when a new issue appears in Sentry so the agent can investigate and propose a fix.
  • Deployment failures - on a failed deploy, have the agent read the logs and open a fix.
  • Scheduled maintenance - on a cron schedule, let the agent bump dependencies, refresh docs, or triage the backlog.
  • New issue triage - when an issue is filed, have the agent label it and draft a first response.

Defining the action

Add the agent action to a pipeline the same way as any other - pick it from the action list, then set the prompt, model, and options:

Image loading...Agent action configuration

Example

This pipeline runs a Claude Code review whenever a pull request targets master:

yaml
- pipeline: on-pull-request events: - type: PULL_REQUEST branches: - master actions: - action: Claude Code type: CLAUDE_CODE integration: anthropic prompts: - make pull request review model: sonnet claude_args: --max-turns 3 dangerously_skip_permissions: true

Key fields:

  • type - the agent action type (CLAUDE_CODE).
  • integration - the integration that provides the agent's credentials (e.g. anthropic).
  • prompts - one or more prompts the agent runs.
  • model - the model to use (e.g. sonnet).
  • claude_args - extra CLI flags passed to the agent (e.g. --max-turns 3).
  • dangerously_skip_permissions - runs the agent without permission prompts so it can act unattended.
Warning
dangerously_skip_permissions: true lets the agent run every tool without asking. Only use it in pipelines you trust, and scope the integration and pipeline variables to what the agent actually needs.

Action outputs

After the agent runs, the action exposes a set of output variables - plus a session file - that later actions in the same pipeline can read:

OUTPUT_CLAUDE_EXECUTION_FILE /buddy/monitoring/claude-output/execution-output-zs1vr0jkq4ecxa.json OUTPUT_CLAUDE_SESSION_ID a5d070a0-ba29-404d-a103-f9f27fe81e4e OUTPUT_CLAUDE_RESULT Hey! How can I help you today? OUTPUT_CLAUDE_CONCLUSION success
  • OUTPUT_CLAUDE_EXECUTION_FILE - path to a JSON file with the full session transcript and execution details.
  • OUTPUT_CLAUDE_SESSION_ID - the agent session ID, useful for referencing or resuming the run.
  • OUTPUT_CLAUDE_RESULT - the agent's final text response.
  • OUTPUT_CLAUDE_CONCLUSION - the outcome of the run (e.g. success).

Downstream actions can branch on OUTPUT_CLAUDE_CONCLUSION, post OUTPUT_CLAUDE_RESULT to Slack, or parse the execution file for the full transcript.

Reference any output variable with a $ prefix. For example, add a Slack action after the agent to post its result:

yaml
- action: Send notification type: SLACK content: "PR review complete:\n$OUTPUT_CLAUDE_RESULT" integration: 5dd50bd38c7dd93b96897d2e channel: releases

See Output variables for how they're passed between actions.

Learn more

  • Run agents in a sandbox - run an agent in an isolated environment from your terminal.
  • Pipelines - triggers, events, and everything else you can wire an agent action into.

Last modified on Jul 24, 2026