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.275.dev202610110131

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

Total release size: 353.5 MB

Release files / codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-win_amd64.whl
Size 57.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
08e0a6410b2c394834e193b163048d72d3be5345992c96102ed3dd845fe07ec5
BLAKE2b-256 checksum
How to use checksums
6d3c8a8022d2c7348b5f90d32c96169a05db4507e7725cd14400e2e456f8c965
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.275.dev202610110131-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-musllinux_1_1_x86_64.whl
Size 50.6 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
744977a5d3d84c29d86ba7fb6a6254d0f8a3cd9aee9893824dcf2076f7c01011
BLAKE2b-256 checksum
How to use checksums
97ed7a29354a284117338bdde1e5dc28e03acae0388752c226fc37001a2fbedc
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.275.dev202610110131-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-musllinux_1_1_aarch64.whl
Size 50.4 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
8a830e39cf03ca54d4a90f58be24510f2b1b94c2377d0193a3250ded279ed07d
BLAKE2b-256 checksum
How to use checksums
3c656841b6810a77b9272c494e720b0a61b0de38537a3ba5dd6fa3f215445a34
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.275.dev202610110131-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-manylinux_2_17_x86_64.whl
Size 53.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f3f8b7244b95b97a6dc9811367027771cd16f51c5ed308da22bd212f4d99d9c3
BLAKE2b-256 checksum
How to use checksums
ac8096fd70708ba91f133b74ea439307a5f2fd2ee9ec6b21a69eaf01a04682cb
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.275.dev202610110131-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-manylinux_2_17_aarch64.whl
Size 53.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1e6d4bc21f2aade6d80ec5d2fba7e0bbdce60dc1e151349cc267640c8d7bb969
BLAKE2b-256 checksum
How to use checksums
d1c2e7d2b94a635c4c592740cb5537482acefc3118651e0c2b4cbe8b00a5f400
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.275.dev202610110131-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-macosx_11_0_arm64.whl
Size 43.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5d4d1fd4e55ba42b7a456a9a192425e59cc59305e33e3db49ef34b9dc85f067e
BLAKE2b-256 checksum
How to use checksums
e1559345ad17dcb4291ede3612fff8974c73300ca7fdf727dd29f482ad26e0d7
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.275.dev202610110131-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.275.dev202610110131-py3-none-macosx_10_12_x86_64.whl
Size 45.9 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1453021796d5b6d704b1aa62ad216e80de23b762083a8f939d86f3ce34a3d487
BLAKE2b-256 checksum
How to use checksums
f1a9a8e68fcaf2b4d7b731373f4f9dbf370eaf4d93d1e522b20ae5a552ee2688
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