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

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.dev202610121523
File
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-musllinux_1_1_x86_64.whl Python 3 none Linux musl 1.1+ x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 387.4 MB

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

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-win_amd64.whl
Size 62.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
acc957793e11593de199df171f03c4d784df747327e873688fb390265077daa3
BLAKE2b-256 checksum
How to use checksums
895c21d2c0e50651dff78212c7ce947c5a0ffbc2a6ae8d987b2160ed06504b6a
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.dev202610121523-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-musllinux_1_1_x86_64.whl
Size 55.1 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ca1c7d900f85bd05a7ec04eed1e5f743ebbdd90083f0103f5e6b73ae1fe79c60
BLAKE2b-256 checksum
How to use checksums
4e8cc02db757ed07d6ab1e1f13048226c59b8e16ada214bc00ffde8eba761eb9
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.dev202610121523-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-musllinux_1_1_aarch64.whl
Size 54.6 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
23173f57bcb28869eb0c5aa487ac93dbdeb9a56888f08d04e194d77b827e0b78
BLAKE2b-256 checksum
How to use checksums
1c77638dd0ff6dbd0a44698eeea3272d00ef228373e6ceba1acdbe02ebb9e1ea
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.dev202610121523-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-manylinux_2_17_x86_64.whl
Size 58.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7be43625368fb875bd4ea6bd48a2d89ad37b8d66e038f0fb32f162fe2fd70481
BLAKE2b-256 checksum
How to use checksums
e973aa124bdc354126527fafceb146efe3e536741034c6d21d6498d36c372261
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.dev202610121523-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-manylinux_2_17_aarch64.whl
Size 58.2 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5b24dc7b5b7c505affc83b477212d72ec3e3f3c3b7f5b572426d3fbd962b414c
BLAKE2b-256 checksum
How to use checksums
61815916ab5d9b7884736fb3891be3284a1a202bbbe7f651d40e8995ce9933bc
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.dev202610121523-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-macosx_11_0_arm64.whl
Size 48.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b9e792dd516676292c44e8350bc749d4780202467816b34b0cc00643b1e68eb9
BLAKE2b-256 checksum
How to use checksums
7b601fff0af78e5fcaad77bb3e2eabbef547db99ab9aefef2f6b9a2835c1564e
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.dev202610121523-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121523-py3-none-macosx_10_12_x86_64.whl
Size 50.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f71bc1d43d8138450b230074b62ed16dea63f6f0973d0fd3df5f9edab02a9de2
BLAKE2b-256 checksum
How to use checksums
9eca5c552ca0b62c93e111fa64a6be30b106dd62c4e7f9b7a92695417951f358
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