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

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

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

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
3312d0d0a60978e924d761f5fb082bb60352f3be75e654f5c52af1f9ccb40aa6
BLAKE2b-256 checksum
How to use checksums
feb1b73841ed919f95561bc2a19dc516eae19ddd7d4f22d5a00b0f24ddbe94a9
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.dev202610121445-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
28ddf6241d97a671c05a77558c25c7ce61ee3260f48bd0b9e360a0e659e59b75
BLAKE2b-256 checksum
How to use checksums
ae9759b94feabf225d1b8a4d26b067955efc8e56cf2c364295301e2f8fc9183a
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.dev202610121445-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
a0d599fc957cb28a45def5d22dce9b49d0daea8d547c5bf9f376ed2158b72466
BLAKE2b-256 checksum
How to use checksums
09a76b3a885d2cd6d879c17e96c4f4b57316ea8505c8bde19793f6ef182f5599
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.dev202610121445-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
2bbd75c52ddf58f22a001fa9f21b615e3f8bd89bc97c55781c9d04d4f11f61f3
BLAKE2b-256 checksum
How to use checksums
5e6dc80a7d1cd112240fdbe6220e4708b27f8b5ab492838e0c1954c8f31c56c9
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.dev202610121445-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
2e9128d2f75a2671d4a8ce88297799ccec986f301c7f4ce9211f2796e4061c03
BLAKE2b-256 checksum
How to use checksums
25678b3f0c42fdd53416f3be6e7d16cfc5197e77a23605433f00d728a341ad3d
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.dev202610121445-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610121445-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
a8f330ed608afab1db9e9224adf1dab8e1cca0953885ea31497b70183d700878
BLAKE2b-256 checksum
How to use checksums
aee1946eb1feec349deff52cc6e27b35ffb9e9c33b3d222e52b1d9beb7074073
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