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.264.dev202609241744

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

Total release size: 349.0 MB

Release files / codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-win_amd64.whl
Size 56.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
9a1f3c4a63ddaced431c2b0d56d691d9058b5f3397b305de0428d883711a98d6
BLAKE2b-256 checksum
How to use checksums
5ca28e831979ac0ecd2adab17d5c6ecc19a47683c6df84d0566628333639f587
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.264.dev202609241744-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-musllinux_1_1_x86_64.whl
Size 50.0 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
aa463ba9ed42c5cef7598017636373d98aca765c727e7033345827cb4cba68aa
BLAKE2b-256 checksum
How to use checksums
e317fbca4446b5019083767da9b2f17b366c8070d10d1b4817eee6fae501f4b2
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.264.dev202609241744-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-musllinux_1_1_aarch64.whl
Size 49.8 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ea5edd0ef85d96e47fd9428a2f8cfd1a0c60f7cd1cd2bd218344c02e002d95a1
BLAKE2b-256 checksum
How to use checksums
72ebd71e2c4218410aa927cee7765908bd6d7577cad7882aaa925925dd2b0ea1
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.264.dev202609241744-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-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
dcf90e354b312ed13ec58a592ee028670087d8b9738d40d0cf3d902c96eb9f9d
BLAKE2b-256 checksum
How to use checksums
03550b956b7a2bb92245d2261decfe1ede82dc7a8eb2825cfa34bdece80c09c8
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.264.dev202609241744-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-manylinux_2_17_aarch64.whl
Size 52.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2744a8e2c71dc3fc2c2aa82b59e8d6e8d9e9488442798e185d67378a1528d898
BLAKE2b-256 checksum
How to use checksums
c3ab192e72e6c730f71b68cde606101b3750c1958be5e4d454ead242112fa589
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.264.dev202609241744-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-macosx_11_0_arm64.whl
Size 42.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
707da8144664d0a3146e2e0056cd62adb6f3f1db1da219c32a74a7eeaf26c045
BLAKE2b-256 checksum
How to use checksums
0d53876f583d0fc6c61875facb0c08716358bb3ec223bf2bd0bb4cdf497aaac0
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.264.dev202609241744-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609241744-py3-none-macosx_10_12_x86_64.whl
Size 45.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d1f5c4719e98d12bc31ff1dc3498f77caf099a81b69d1e367e914f7c6f944330
BLAKE2b-256 checksum
How to use checksums
435c7cfd939469534b70e3d762a1356c64547c52de1cf5bf09605d3615ca2bcc
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