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.278.dev202610151416

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

Total release size: 391.6 MB

Release files / codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-win_amd64.whl
Size 62.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
02225e2d4d669cb321eb199ec0db314254eb566c1261e1916d90275213e60ad0
BLAKE2b-256 checksum
How to use checksums
10b190729ff067716f577c4451276180b7605cb7b52f870dca81fa45983827be
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.278.dev202610151416-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-musllinux_1_1_x86_64.whl
Size 55.7 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f16ac942bb294a7358da7fd17df16b30375dfd4c50ee2de40b0ca3a72b47a326
BLAKE2b-256 checksum
How to use checksums
0506acbcb3ae77854579b1d4b5468b85ee9a26f861616f6fe70760be3dcdf614
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.278.dev202610151416-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-musllinux_1_1_aarch64.whl
Size 55.2 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a2449a3bca8985c39b08bbcf155bef1832275e1b6248feddeaf1e82850003121
BLAKE2b-256 checksum
How to use checksums
fcd05e3bb24b11e77b1a331f083b65cf803e129674c3da59dab16ece5ec5cd99
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.278.dev202610151416-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-manylinux_2_17_x86_64.whl
Size 59.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
3d52918efd583a1f5331af06edee92603f6262e3ebc44ce506f6167c0f1e16df
BLAKE2b-256 checksum
How to use checksums
68add2cae4fe0ec9a1693b7cd6ab8c7daeecb4dcb00568ab8e36fa76dffce154
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.278.dev202610151416-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-manylinux_2_17_aarch64.whl
Size 58.8 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
30ac5e708a2f3a269770e763650b58bcb80b1547c15fe4b6864133b0103c9cf2
BLAKE2b-256 checksum
How to use checksums
8d6005561fd8950535ab15eaeaf07309121438c17a06702dc703e1b1e399f3d8
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.278.dev202610151416-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-py3-none-macosx_11_0_arm64.whl
Size 49.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
91a0853f4cadd810b35b598654e98cf8179346e247d65b0f6d73b7d5c3fdaa06
BLAKE2b-256 checksum
How to use checksums
84004ed21ac738fc99d51f4ef0064bfdc2b29a56e5c7d20fba8f7d266bd2a8d2
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.278.dev202610151416-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610151416-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
4715f40d38e7c9d38abfb14ea99b915f174ecd85cfa81cdd293c71a248b89cc5
BLAKE2b-256 checksum
How to use checksums
f37bb0e96bd4a6f055be1b56d2fa61b7588a59a3c13a7b1cfbe6a5ba81905ee6
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