Bitbucket

BitbucketTools enables agents to interact with Bitbucket repositories for managing code, pull requests, and issues.

Prerequisites

The following example requires the requests and openai libraries.

uv pip install agno requests openai
export BITBUCKET_USERNAME="your-atlassian-account@example.com"
export BITBUCKET_TOKEN="your-scoped-api-token"

The Agent model uses an OpenAI key, separately from any toolkit provider credentials.

Set OpenAI Key

Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.

export OPENAI_API_KEY=sk-***

Bitbucket Cloud disabled app passwords on June 9, 2026. Use your Atlassian account email and a scoped API token; this toolkit sends them as HTTP Basic credentials. For the pull-request example, grant read:pullrequest:bitbucket and use a workspace/repository the account can access. See API token permissions.

Example

The following agent can manage Bitbucket repositories:

from agno.agent import Agent
from agno.tools.bitbucket import BitbucketTools

agent = Agent(
    instructions=[
        "You are a Bitbucket repository management assistant",
        "Help users manage their Bitbucket repositories, pull requests, and issues",
        "Provide clear information about repository operations",
        "Handle errors gracefully and suggest solutions",
    ],
    tools=[BitbucketTools(
        workspace="your-workspace",
        repo_slug="your-repository"
    )],
)

agent.print_response("List all pull requests for this repository", stream=True)

Toolkit Params

ParameterTypeDefaultDescription
server_urlstr"api.bitbucket.org"Base host for the Cloud REST API; operations use Cloud API paths.
usernameOptional[str]NoneAtlassian account email for API-token auth; falls back to BITBUCKET_USERNAME.
passwordOptional[str]NoneBasic-auth secret fallback from BITBUCKET_PASSWORD when token is absent; app passwords are retired.
tokenOptional[str]NoneScoped API token paired with account email; falls back to BITBUCKET_TOKEN. Not a Bearer OAuth token.
workspaceOptional[str]NoneBitbucket workspace name (required).
repo_slugOptional[str]NoneRepository slug name (required).
api_versionstr"2.0"Bitbucket API version to use.
timeoutint30Request timeout in seconds.

Toolkit Functions

FunctionDescription
list_repositoriesList repositories in the workspace.
get_repository_detailsGet detailed information about the repository.
create_repositoryCreate a new repository in the workspace.
list_repository_commitsList commits in the repository.
list_all_pull_requestsList pull requests in the repository, filtered by state.
get_pull_request_detailsGet details of a specific pull request.
get_pull_request_changesGet the diff of a pull request.
list_issuesList issues in the repository.

You can use include_tools or exclude_tools to modify the list of tools the agent has access to. Learn more about selecting tools.

Developer Resources