Bitbucket
BitbucketTools enables agents to interact with Bitbucket repositories for managing code, pull requests, and issues.
Example
The following agent can manage Bitbucket repositories:
1from kern.agent import Agent2from kern.tools.bitbucket import BitbucketTools34agent = Agent(5 instructions=[6 "You are a Bitbucket repository management assistant",7 "Help users manage their Bitbucket repositories, pull requests, and issues",8 "Provide clear information about repository operations",9 "Handle errors gracefully and suggest solutions",10 ],11 tools=[BitbucketTools(12 workspace="your-workspace",13 repo_slug="your-repository"14 )],15)1617agent.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. |
Toolkit Functions
| Function | Description |
|---|---|
get_issue | Get details of a specific issue by ID. |
get_issues | List all issues in the repository. |
create_issue | Create a new issue in the repository. |
update_issue | Update an existing issue. |
get_pull_request | Get details of a specific pull request. |
get_pull_requests | List all pull requests in the repository. |
create_pull_request | Create a new pull request. |
update_pull_request | Update an existing pull request. |
get_pull_request_diff | Get the diff/changes of a pull request. |
get_pull_request_commits | Get commits associated with a pull request. |
get_repository_info | Get detailed information about the repository. |
get_branches | List all branches in the repository. |
get_commits | List commits in the repository. |
get_file_content | Get the content of a specific file from 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.