Bitbucket

List open pull requests, repositories and commits for a Bitbucket workspace and repo slug with BitbucketTools.

Enable Agno agents to interact with Bitbucket repositories, pull requests, and commits.

Prerequisites

Install agno openai requests and export your OpenAI API key. Bitbucket Cloud retired app passwords on June 9, 2026. Create a scoped API token with read:pullrequest:bitbucket permission for the pull-request example, then set:

export OPENAI_API_KEY="your_openai_api_key_here"
export BITBUCKET_USERNAME="your-atlassian-account@example.com"
export BITBUCKET_TOKEN="your-scoped-api-token"

The toolkit sends the account email and token as HTTP Basic credentials. Replace workspace and repo_slug below with a repository your account can access. See API token permissions for other operations.


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

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

repo_slug = "ai"
workspace = "MaximMFP"

agent = Agent(
    tools=[BitbucketTools(workspace=workspace, repo_slug=repo_slug)],
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("List open pull requests", markdown=True)

    # Example 1: Get specific pull request details
    # agent.print_response("Get details of pull request #23", markdown=True)

    # Example 2: Get the repo details
    # agent.print_response("Get details of the repository", markdown=True)

    # Example 3: List repositories
    # agent.print_response("List 5 repositories for this workspace", markdown=True)

    # Example 4: List commits
    # agent.print_response("List the last 20 commits", markdown=True)

Run the Example

# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno
git checkout d703c34f3abf3c41275d3fb2da6e0518a8881f24

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
uv pip install -U requests

python cookbook/91_tools/bitbucket_tools.py

For details, see Bitbucket cookbook.