Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CodeBuddy Agent SDK for Python

SDK for building AI agents with CodeBuddy Code's capabilities. Programmatically interact with AI to build autonomous agents that can understand codebases, edit files, and execute workflows.

Installation

# Using uv (recommended)
uv add codebuddy-agent-sdk

# Using pip
pip install codebuddy-agent-sdk

Quick Start

import asyncio
from codebuddy_agent_sdk import query

async def main():
    async for message in query(
        prompt="What files are in this directory?",
        permission_mode="bypassPermissions",
    ):
        if message.type == "assistant":
            for block in message.content:
                if hasattr(block, "text"):
                    print(block.text)

asyncio.run(main())

API Reference

query(prompt, **options)

Create a query to interact with the agent.

async for message in query(
    prompt="Your prompt here",
    model="sonnet",                    # Model to use
    permission_mode="bypassPermissions",  # Permission mode
    max_turns=10,                      # Maximum conversation turns
    cwd="/path/to/project",            # Working directory
):
    # Handle message
    pass

Message Types

  • system - Session initialization info
  • assistant - Agent responses (text, tool calls)
  • result - Query completion status
  • task_started / task_notification - Background task lifecycle events (TaskStartedMessage / TaskNotificationMessage, both subclasses of SystemMessage). Emitted when a tool runs a command with run_in_background: true. Concurrent tasks are told apart by task_id.

Background tasks

Background task completion can arrive after the first ResultMessage, so use CodeBuddySDKClient with receive_messages() (which keeps reading) rather than query() / receive_response() (which stop at the first result):

from codebuddy_agent_sdk import (
    CodeBuddySDKClient,
    CodeBuddyAgentOptions,
    TaskStartedMessage,
    TaskNotificationMessage,
)

async def main():
    options = CodeBuddyAgentOptions(permission_mode="bypassPermissions")
    async with CodeBuddySDKClient(options=options) as client:
        await client.query("Run a background command and report when it finishes")
        async for msg in client.receive_messages():
            if isinstance(msg, TaskStartedMessage):
                print("started", msg.task_id, msg.description)
            elif isinstance(msg, TaskNotificationMessage):
                print("done", msg.task_id, msg.status, msg.output_file)

Feedback

Metadata

Release files for codebuddy-agent-sdk 0.3.276.dev202610141731

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for codebuddy-agent-sdk 0.3.276.dev202610141731
File
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_x86_64.whl Python 3 none Linux musl 1.1+ x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 391.3 MB

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-win_amd64.whl
Size 62.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
efa65e51db80300d593bf8b38c0d0c05449e0120abc100cf916731fa1627641a
BLAKE2b-256 checksum
How to use checksums
202905e5428d65b9c49aba495345c2e6f7911453846026afee906675bd51b897
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_x86_64.whl
Size 55.6 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
04bba335257896de5b39d1c598e429dc99ae96dc80a3f5e79da592735fd897bc
BLAKE2b-256 checksum
How to use checksums
e8ec4cd1d17fd73dff168cff898781710fb2963b2016e9ade2465c4472c7e291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-musllinux_1_1_aarch64.whl
Size 55.1 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9c02c3169b149f8adff932f99b3d406d70e4ba74fba55a4e2699c99fdc1b0e12
BLAKE2b-256 checksum
How to use checksums
ba42fbb8be282a10e7a9f94f7b5ef0166c5f6c3f1323945108cdff0c985d28fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_x86_64.whl
Size 59.0 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b86c15c202e9fe8a30340aa4e1c08b07cebf5ff4da2b2e7aa667a03740e72139
BLAKE2b-256 checksum
How to use checksums
9c78a5e7d2fd43bbf62112f46378062fe37e6652d5329ceb1cf220589e40fe6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-manylinux_2_17_aarch64.whl
Size 58.7 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
47dcc168cb2d8bb146388b959ad2bc22c8f3e96c632c1bb842401f9c7db6e64a
BLAKE2b-256 checksum
How to use checksums
65b15b0e81189bfb88f6077ae373040864d8680d9a77807ed0c12b6c1018d9e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_11_0_arm64.whl
Size 48.9 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ed6c15edea397561db9b81f98ae4d7ec040926d91f8c91c1b33f37e9ce53ee74
BLAKE2b-256 checksum
How to use checksums
be64e5db12ff1d8ce0ae13e6de8943a129fe50b66c463943cd20be0a34394f98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610141731-py3-none-macosx_10_12_x86_64.whl
Size 51.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ada32ea209f06278587a8d4a5d64771b0b8218bf51ca18a1e285f3db0be01845
BLAKE2b-256 checksum
How to use checksums
10566b3a586eae181c4c17c645ebdc9ae5362ed6e4b58b6eddee135a9df3f409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page