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

Release files for codebuddy-agent-sdk 0.3.263.dev202609231948

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

Total release size: 348.6 MB

Release files / codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-win_amd64.whl
Size 56.5 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
71e13409d6ea85ccd2b9f593144e40035c1381e758762c0d535bb47c9557991e
BLAKE2b-256 checksum
How to use checksums
a965243b8ff6f3483ed4904c92c6fab5b0705ab969ceb5ff4a41ac0857284daa
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.263.dev202609231948-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-musllinux_1_1_x86_64.whl
Size 49.9 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
1d1935c598d9bb5409b550788029733011917d49a59c4053ccdf4372713e40e2
BLAKE2b-256 checksum
How to use checksums
05f6f1a25f9fea410cbe29ab84fe44c99cd1acb904a8937a36a55b5f3e277ec4
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.263.dev202609231948-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-musllinux_1_1_aarch64.whl
Size 49.7 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1386e91f9da8182133e98a847ea87ca56dae0ed524f5e91974b6e7bc24977251
BLAKE2b-256 checksum
How to use checksums
1c4548fbf5954c6580578c4a2ec2a0eb72a5fc92d7be6a744f3a64655dac3e0a
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.263.dev202609231948-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-manylinux_2_17_x86_64.whl
Size 52.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
170eb0e6f78ec67d5d4f6f1645e014dc62e47000c75c547a927fa1a140ea5549
BLAKE2b-256 checksum
How to use checksums
c0cf4222fe1fb19a7440274644bb7d786f091fad1663aa4eb87957ffe37c8579
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.263.dev202609231948-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-manylinux_2_17_aarch64.whl
Size 52.3 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
875e14ce17ca202d5cc515e1de58da7f52e55f717eae0da24abd39ee86e7ccb2
BLAKE2b-256 checksum
How to use checksums
f64f367c6d094147c41dca7c5cdfb27e3c11c27ca9f02b9bd8b9ab650f7f20f6
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.263.dev202609231948-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-macosx_11_0_arm64.whl
Size 42.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8b42de983ec8e0c2dc503915ee113b7393862b31bda23847f0ebecc264621004
BLAKE2b-256 checksum
How to use checksums
1ea84ef2198c1e19a621bace9978deb4d1db5ac69b78b2d73a991283c9860c9f
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.263.dev202609231948-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263.dev202609231948-py3-none-macosx_10_12_x86_64.whl
Size 45.2 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4cb925ca33f9fd614857adf804e7edadb74bf437a125808add0e72d1f0e68dd5
BLAKE2b-256 checksum
How to use checksums
e52cd0f94b0db88662e4c3d973007029970aab99878faa8b85047f0c01004109
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 history Release notifications | RSS feed

This release

0.0.1

2 release files

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