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

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

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

Total release size: 488.1 MB

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

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-py3-none-win_amd64.whl
Size 76.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
491f76c1effbe878ea6d31a2a0debfe86d4d78a855d8878f5c154eb8061dc01e
BLAKE2b-256 checksum
How to use checksums
181c5d2f4ee433229acb4ad115614332fd942d7e251e332c78ae445c69eb4f44
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.dev202612011206-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-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
11d858950928df0368a750f6b5f5d4ae1c2e231f2eb23e82b1375ff8e96b6bf7
BLAKE2b-256 checksum
How to use checksums
814566624a201aa9d16a96ea7b7ac405a57bcdc87f75b0261d5a86e026de82d0
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.dev202612011206-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-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
8713f2e0ba1361b145024ccb7f530d7f01663eed855df031e3d1604c36426133
BLAKE2b-256 checksum
How to use checksums
fe3a4b001a510f05a885a07f3b641039caedcb4f9f81dc92fc46370cef39094b
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.dev202612011206-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-py3-none-manylinux_2_17_x86_64.whl
Size 72.8 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
84101dd2d2bfc49ed30e2b9881677853cb22fe182e10ce21f7758c51c73ab0f8
BLAKE2b-256 checksum
How to use checksums
71e01eb1cb13a69762a1badc2a9ecc27922c544accff5eba3a78ac23d2c3c5b8
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.dev202612011206-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-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
5bbbda420e45df6ddf7461c0fb98669464d39e2d4e852ea41bb4500ba6d97946
BLAKE2b-256 checksum
How to use checksums
5e47d393394b9c9db318ac09d01be97223e6c7cd080f40201d8b07c3af340774
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.dev202612011206-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-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
9e9e1ae2fa8e0a511c0ab965aa2cc9b8d1f043b517dd45b409b3b7dc651f8570
BLAKE2b-256 checksum
How to use checksums
cc1142dc0566876b8140397a4e711bcbd890cb81a4e12ed9dfd6e34ae9d62de7
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.dev202612011206-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.307.dev202612011206-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
24c4a447c2c2c28ac612fac7cc5e6dad5b0d679fa4ed22793ef40f38342ba54b
BLAKE2b-256 checksum
How to use checksums
4451b0bbd113bfed4267e5c859156904ea49fa74d67b5d816c628a137bfc4566
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.dev202612011206

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

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