> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

```shell theme={null}
uv pip install requests openai
```

```shell theme={null}
export BITBUCKET_USERNAME="your_username"
export BITBUCKET_PASSWORD="your_app_password"
```

## Example

The following agent can manage Bitbucket repositories:

```python theme={null}
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

| Parameter | Type | Default | Description |
| - | - | - | - |
| `server_url` | `str` | `"api.bitbucket.org"` | Bitbucket server URL (for Bitbucket Server instances). |
| `username` | `Optional[str]` | `None` | Bitbucket username. Uses BITBUCKET\_USERNAME if not set. |
| `password` | `Optional[str]` | `None` | Bitbucket app password. Uses BITBUCKET\_PASSWORD if not set. |
| `token` | `Optional[str]` | `None` | Access token. Uses BITBUCKET\_TOKEN if not set. |
| `workspace` | `Optional[str]` | `None` | Bitbucket workspace name (required). |
| `repo_slug` | `Optional[str]` | `None` | Repository slug name (required). |
| `api_version` | `str` | `"2.0"` | Bitbucket API version to use. |
| `timeout` | `int` | `30` | Request timeout in seconds. |

## Toolkit Functions

| Function | Description |
| - | - |
| `list_repositories` | List repositories in the workspace. |
| `get_repository_details` | Get detailed information about the repository. |
| `create_repository` | Create a new repository in the workspace. |
| `list_repository_commits` | List commits in the repository. |
| `list_all_pull_requests` | List pull requests in the repository, filtered by state. |
| `get_pull_request_details` | Get details of a specific pull request. |
| `get_pull_request_changes` | Get the diff of a pull request. |
| `list_issues` | List 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](https://agno-v2.mintlify.site/tools/selecting-tools.md).

## Developer Resources

* [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/bitbucket.py)
* [Bitbucket API Documentation](https://developer.atlassian.com/bitbucket/api/2/reference/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.