Skip to main content

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

Model listing

CodeBuddySDKClient can fetch the model catalog from the CLI:

from codebuddy_agent_sdk import CodeBuddySDKClient, CodeBuddyAgentOptions

async def main():
    async with CodeBuddySDKClient(options=CodeBuddyAgentOptions()) as client:
        # Live catalog (one control request each):
        models = await client.get_available_models()    # [{model_id, name, description}]
        raw = await client.get_available_models_raw()   # full configs (url/apiKey stripped)

        # Snapshot captured during the initialize handshake:
        snapshot = await client.supported_models()      # [ModelInfo(value, display_name, description)]

get_available_models() / get_available_models_raw() work right after connect(); supported_models() is a read-only metadata read (a bare initialize control request) that never touches the session handshake.

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

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

Total release size: 488.1 MB

Release files / codebuddy_agent_sdk-0.3.307-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-win_amd64.whl
Size 76.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
68901948a612920444a4fbac46be652d75da057bd9cffe8bd3c3d20e127b2e2a
BLAKE2b-256 checksum
How to use checksums
e0ba2d00b8bc2437b900d51cbcee582c90daaa55ee64bfe85420ec80952a9a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-musllinux_1_1_x86_64.whl
Size 69.2 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
af2a2c1e706cb998dc589180c277223bba3f5f50f2186a2237ac3f6e3bc915b3
BLAKE2b-256 checksum
How to use checksums
d8fe4fbcc855ee189775d1c5b406e9d3419a596dc5e15b711543b00366f50521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-musllinux_1_1_aarch64.whl
Size 68.7 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
3fc2f94df6e1f5eb44390c64d1a5c16a7596f46817c3fb786f166eb1d3c965ff
BLAKE2b-256 checksum
How to use checksums
87a8673bc1129578daf9063a895f46de8eee9b761fa3f01acde8af6e5fd8c3bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-manylinux_2_17_x86_64.whl
Size 72.7 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8ece17f2bbff5ebff7cac561c92d2148bd32dad9ea5ac0de8a55a4b2759fd42a
BLAKE2b-256 checksum
How to use checksums
bb44963425202483630e59c56f2d0cec1ef5b3293a8aadc83181d09f14f51e60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-manylinux_2_17_aarch64.whl
Size 72.5 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
d0e23263122e706852a14fea9c66dea7b5476ebfa8d02276a1252d3d966b71bb
BLAKE2b-256 checksum
How to use checksums
af724dfcabf8f831f4fad7dc19a723d016c9b0dff1dabbaad4f238b05682e61d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-macosx_11_0_arm64.whl
Size 62.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3013e10110c0f6e0d5d72aee59a7d25450123cfed89de932db1141890f7d4197
BLAKE2b-256 checksum
How to use checksums
ccb94eda8f4690bf07e414be867311933386eb6731c339c000567ca37f71e8b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.307-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307-py3-none-macosx_10_12_x86_64.whl
Size 65.5 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b0d2ffdcdf5b339773ff06ee12dc8933c67cf2f7681d4d49af70ba3aa8617446
BLAKE2b-256 checksum
How to use checksums
16a1403fe11d20ae1971fe57b30743a9081d6995bcfb118eaf8bd7ae4a102718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Security for codebuddy-agent-sdk 0.3.307

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.307 This release

7 release files No provenance

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