Agentic Pipelines

Agentic Pipelines is in beta.

Agentic Pipelines lets you embed AI agents directly into your Bitbucket Pipelines steps. These agents can analyze your code, troubleshoot failing pipelines, generate release notes, fix flaky tests, and more — all while running in your existing CI/CD workflows.

With Agentic Pipelines, you define agents in bitbucket-pipelines.yml and run them non‑interactively inside a pipeline step or via triggers. Agents run in the same environment as your build, and can be granted controlled access to Bitbucket using MCP tools and scoped OAuth permissions.


はじめる前に

Agentic Pipelines provides a framework to define and configure agents and run them non‑interactively within steps or on triggers. The sections below describe when to use agents, core concepts, and how to get started.

Use Agentic Pipelines when you want to do any or all of the following:

  • Automate code review, debugging, or release tasks

  • Reuse prompts you already tested with local agents inside Bitbucket Pipelines

  • Run multiple agentic background tasks in a secure environment and with limited permissions, for example - generating code or documentation

  • Automate tasks that are well-defined but require an understanding of the code change, for example - raising a pull request for another package if a new entity was added

It’s NOT a replacement for:

  • Your existing build or test steps

  • We wouldn’t recommend using the result of an AI-completed task as a release gate, because the result can be non-deterministic and requires human verification. However, it can be used to provide additional information that aids in making a decision.

動作の仕組み

Initially, Agentic Pipelines supports Rovo Dev as the agentic tool for executing these workflows. However, support for 3rd-party CLI’s like Claude Code is coming in the following weeks.

Agentic Pipelines connects Bitbucket Pipelines with an AI agent. You define agents in your pipeline configuration and describe tasks by using natural language instead of writing complicated shell scripts.

Agents run inside your Pipelines step containers, with access to the following:

  • Your repository checkout.

  • Your build tools and dependencies.

  • Bitbucket APIs via a built-in Model Context Protocol (MCP) server.

  • Scoped OAuth tokens so they can safely act back on your repository (for example, pushing commits or creating pull requests). See for more information.

This transforms your pipelines from strict CI/CD into an agentic SDLC automation-environment where tasks such as code reviews, debugging, refactoring, or content generation can be automated.

Integrate Rovo Dev with Agentic Pipelines

To use Agentic Pipelines with Rovo Dev, you need:

  • A paid Bitbucket Cloud account with Pipelines enabled.

  • A paid Rovo Dev Standard subscription for your site.

We recommend creating a dedicated user account for Agentic Pipelines usage. This keeps ownership and permissions consistent, and avoids coupling agent behaviour to an individual developer’s personal account.

Before configuring anything in Bitbucket, make sure Rovo Dev is enabled for your Atlassian site/org and Rovo Dev CLI access is enabled for the account you plan to use in Pipelines. Refer to the Turn Rovo Dev features on and off help document for more information.

Rovo Dev authenticates using an Atlassian API token. Create a token for the bot account and store it securely. For details, refer to the Manage API tokens for your Atlassian accountfor more information.

To use Agentic Pipelines with Rovo Dev, your build container must have the following environment variables available:

  • USER_API_TOKEN (secret)

  • USER_EMAIL

  • BILLING_SITE_URL (for example, <https://yoursite.atlassian.net)>

There are multiple ways to provide these variables to a pipeline step.

We recommend a set of global user credentials configured as secured variables at the workspace-level to operate as the default account for your workspace.

If you want to scope Rovo Dev usage for specific repositories to different user credentials you can do this by configuring different credentials at the repository level. The repo-level variables will take precedent over the workspace-level variables at runtime.

Alternatively, for advanced use-cases, you can use a third-party secrets provider so that secrets are injected at runtime instead of being stored in Bitbucket.

For details, see:

Quick start guide to run your first agent

The following example defines a simple agent and runs it as a custom pipeline to help explain test failures:

Example simple agent

image: "atlassian/default-image:5" definitions: agents: explain-test-failure: prompt: | You are helping a developer understand why their CI tests failed. The file $TEST_INPUT contains npm test output showing test failures. - Analyze the test output and identify all failing tests - Briefly summarize what failed and where (test file and line numbers) - Identify the most likely root cause for each failure - Point to specific files, tests, or code sections if possible - Suggest 2-5 concrete next steps to fix the issues - If multiple unrelated failures exist, group them clearly - Save the result to a file $TEST_ANALYSIS_OUTPUT Format your response in markdown for readability. pipelines: custom: explain-test-failure: - step: name: Explain test failure script: - export TEST_INPUT=input.log - export TEST_ANALYSIS_OUTPUT=output.md - npm install - npm test > $TEST_INPUT || true - agent: explain-test-failure artifacts: - output.md

Steps to run the example agent

Follow these steps to understand how using agentic pipelines can help you analyse test failures from the example above.

  1. Add the agent and custom pipeline defined above to your bitbucket-pipelines.yml file in your repository.

  2. Select Pipelines on the left sidebar in your repository, and select the Run pipeline button.

  3. Select the ‘custom: explain-test-failure’ pipeline from the Pipeline dropdown in the Run pipeline dialog.

  4. Select the Run button in the Run pipeline dialog to run the pipeline.

This particular example agent will do the following:

  • Run inside the step container and analyze the output of the ‘npm test’ command.

  • The result of the analysis will be saved to a file and preserved as an artifact for future review.

Additionally, the step log in the Pipelines user interface (UI) will show that the step contains an AI agent, as well as the structured output from the agent.


Define an agent in your pipeline

Agents are defined in the definitions section of your bitbucket-pipelines.yml.

Basic inline definition

  • Each agent has a name (pull-request-comment-reviewer in this example).

  • Each agent has a prompt that can reference context variables, such as $BITBUCKET_PR_ID or $BITBUCKET_BRANCH, that describes what you want the agent to do when it runs.
    see: Variables and secrets | Bitbucket Cloud | Atlassian Support

image: "atlassian/default-image:5" definitions: agents: pull-request-comment-reviewer: prompt: Can you review the comments on $BITBUCKET_PR_ID \ and provide me a summary of them as a comment on the pull request?

Run an agent in a step

To run an agent, reference it in the script section of a step using the agent: keyword.

image: "atlassian/default-image:5" definitions: agents: pull-request-comment-reviewer: prompt: Can you review the comments on $BITBUCKET_PR_ID \ and provide me a summary of them as a comment on the pull request? pipelines: custom: analyse-pr-comments: - step: auth: system: scopes: - read:pullrequest:bitbucket script: - agent: pull-request-comment-reviewer

When a step contains agent: <agent-name> in its script, Bitbucket Pipelines will do the following:

  • Initialize the configured agent runtime.

  • Apply the Bitbucket‑specific system configuration.

  • Attach the Bitbucket Cloud MCP server.

  • Run the agent non‑interactively with your prompt.

Trigger agents with conditions

You can run agents in response to Bitbucket events using the triggers and conditions syntax.

The example provided below will generate release notes on pull request updates to main or master.

image: "atlassian/default-image:5" definitions: agents: release-notes-generator: prompt: | For the code changes in the diff from $BITBUCKET_BRANCH and $BITBUCKET_PR_DESTINATION_BRANCH, create a release notes file committed to a new branch. Create a new pull request for the new branch targeting $BITBUCKET_BRANCH and set the reviewerUuid as $BITBUCKET_STEP_TRIGGERER_UUID. pipelines: custom: generate-release-notes: - step: auth: system: scopes: - write:repository:bitbucket - read:pullrequest:bitbucket - write:pullrequest:bitbucket script: - agent: release-notes-generator triggers: pullrequest-push: - condition: BITBUCKET_PR_DESTINATION_BRANCH == "main" pipelines: - generate-release-notes

For more about the triggers and condition syntax, see Pipeline start conditions | Bitbucket Cloud | Atlassian Support


Providing a custom config file for agent

You can supply your own agent configuration and have Pipelines merge it with the system config.

You can store the config:

  • in your repository

  • included into the build image

  • generated earlier in the step script

For more information on using custom config files, see the Agent configuration files help document.


Platform integrations: Bitbucket Cloud MCP server

The Bitbucket Cloud MCP server lets any supported agent runtime interact securely with Bitbucket. It exposes tools (for example, creating pull requests, commenting) that your agent can use to automate tasks simply by having them referenced in your natural language prompts.

For more information on how your agents can interact directly with Bitbucket Cloud, see the Interacting with Bitbucket via MCP help document.


Pricing and requirements

Agentic Pipelines steps run as normal Bitbucket Pipelines steps and follow the same billing model:

  • Build minutes - All agentic steps consume Bitbucket Pipelines build minutes in the same way as any other pipelines step.

  • Token consumption - Bitbucket Pipelines are not charging for token consumption, but it requires an integration with an LLM provider that may charge you separately.

    • RovoDev will consume Rovo dev credits for the actions performed by Rovo Dev in pipelines (like code review, adding tests, etc). Consumed credits will be attributed to the user who’s API key was used to configure Agentic Pipelines. If you exceed the Rovo Dev credits for your org, agentic steps may not start until those limits are reset.


System defaults (what Bitbucket Pipelines configures for you)

When you run an agentic step in Bitbucket Pipelines, the system:

  • Installs an agent CLI into the build container

  • Applies a system base configuration tailored for Bitbucket Pipelines

  • Injects a Bitbucket Cloud MCP server configured with the step’s OAuth token

  • Adds an extra system prompt so the agent:

    • understands it is running in a CI/CD step

    • does not ask for interactive user input

    • understands $ENV reference to environment variables

既知の制限事項

  • Agentic CI/CD is not supported on self‑hosted runners

  • Only a single agent can be used per step

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。