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

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

Total release size: 476.1 MB

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

Download URL codebuddy_agent_sdk-0.3.305-py3-none-win_amd64.whl
Size 74.9 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
4b25a215e1ea08c9493099188e2d7ba3008b7a2afa532a0503ef0d9e13c19e07
BLAKE2b-256 checksum
How to use checksums
e761f07949db89afbfce5ce316abd8e78ad8ba03943802412d64d269ca22b690
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.305-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-musllinux_1_1_x86_64.whl
Size 67.5 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a2dbd5ba977cb6b50e5df38cef23e59847bd3a9e6b49e8b212edfe6ae8ccbd29
BLAKE2b-256 checksum
How to use checksums
fee164946fe1bc891281c4f55b3c7f619d5681325bbf1ecf7f1e2a7928bc7511
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.305-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-musllinux_1_1_aarch64.whl
Size 67.0 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
336a3a98026e45762735775a6f4ada2e796f456704be1307ce8f892bde431e0a
BLAKE2b-256 checksum
How to use checksums
4b5b72b1ba9f4fc628105b8b444546a3ce61dbdcae8e4f934b0226df8b8d6194
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.305-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-manylinux_2_17_x86_64.whl
Size 71.0 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
6a8efc4b9c0cbe71dbd53403a1ba12fd8cf8d541bbecc18daf590e6f89756f1b
BLAKE2b-256 checksum
How to use checksums
4ca5edd28eeb93105311902ec08d3724aeb7efaca91b52fa2ff779908ddb098c
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.305-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-manylinux_2_17_aarch64.whl
Size 70.8 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
61b9134cc5668c6db18e04da3be36ad00391aea9fa9df79585287fa7afbc51b9
BLAKE2b-256 checksum
How to use checksums
06763578dc3195fce2eb31c81b29b0c299d7cd213657a453d8aec078460f18fd
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.305-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-macosx_11_0_arm64.whl
Size 61.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c03a0c0d567db146d5d4a8514d7b9970009d3b5518c6e962712a270d85307b43
BLAKE2b-256 checksum
How to use checksums
ce94dbf63715f1108ae5fc82893247b84fd3e3a03638e055060ef37367d2e7d6
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.305-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.305-py3-none-macosx_10_12_x86_64.whl
Size 63.8 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5cd4d3624e81256e0b664dd8caeaefc195bf33f739e63394b0aee1473c69e222
BLAKE2b-256 checksum
How to use checksums
b6371c2112de762983d72474ecc3c02174f2217bc7140ff28f2db860710a40e1
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.305

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