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

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

Total release size: 391.7 MB

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

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-py3-none-win_amd64.whl
Size 62.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
47383dcac96466ec4879bc721ebd10e11e5ea9e4c289f7c6fe727e77c3c1c3b7
BLAKE2b-256 checksum
How to use checksums
ba1681407226dbc2b4f483c7148dd8558478d6a6b10b2360d9e38f5b661ea23a
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.dev202610152229-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
5422c6fae61845f70218f507b03a0465b1c97e5c29fd1a66778cefb926c8ee3c
BLAKE2b-256 checksum
How to use checksums
ec4236b706225bc14e49b2d5c291736da877be05800342842472b76ac9fa4d14
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.dev202610152229-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
5cf582ef8a4225a2706ede27f3700fe2dc6e44d8867b0c3b4b1cffa14a730062
BLAKE2b-256 checksum
How to use checksums
2e2f0d6f7ecf5ccf85ea80c57a6fc3a36af4c700b0d2bedaf85600ec982ca6b3
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.dev202610152229-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
35b6d1e8d33e424a497e2462de802f765d6550ff3815084133a7a7ee38f64dc3
BLAKE2b-256 checksum
How to use checksums
894a194434cc804d650e20a5c9debcabf6d28bfa7686bad2fcc9704f35507a40
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.dev202610152229-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
89386b2604fb7ed524049b4a8f16a94ee300a93e0dc88a63490c9edb7fd14b31
BLAKE2b-256 checksum
How to use checksums
60a3a5a644e3a501a7df245d490fe7c727789015032d2f4a6ddb01c985fc86f7
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.dev202610152229-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
673d129fc003f782cc6c7e4a7b4ee895eb7cd65211f16c3abd927361e1e50611
BLAKE2b-256 checksum
How to use checksums
5ef28ff71d6fcaac9e0e49bd20a11030d2f0c5daa0d5325d6238b35e2b35ca5d
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.dev202610152229-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.278.dev202610152229-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
dd46b75e66264ae356c9a98c91ae829f1db276a2b7f4f2818fc648a031a3aa0d
BLAKE2b-256 checksum
How to use checksums
bbee42b94f221a12555502dd9f3266a0a2dbb5bb7a6bb62783f6cbc5b101654d
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