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

Release files for codebuddy-agent-sdk 0.3.263rc202609231741

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

Total release size: 348.8 MB

Release files / codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-win_amd64.whl
Size 56.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
1300d8234e910e45f262fcec09f40fd624393f836d69e148f8bed3bbcc00b8df
BLAKE2b-256 checksum
How to use checksums
c80bb1030bfb9b8e669a99760c06f9ba5da240cd2f86decdbd3ec139dbde8947
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.263rc202609231741-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-musllinux_1_1_x86_64.whl
Size 49.9 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2709e94bbdec534961920cb0069b4a8e392f758761aa2cb0814e807fc338aedd
BLAKE2b-256 checksum
How to use checksums
3c5afa311ea297bbf14f5174c660c935628fcf42b05cafff8f6bb888964f528a
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.263rc202609231741-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-musllinux_1_1_aarch64.whl
Size 49.7 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
bc31aaef42e9224a56f2eb56c3cd83dc51f3d8f21cccd76989b42b01b30181f7
BLAKE2b-256 checksum
How to use checksums
4a9f7814a234ce2730df4e5a8360b73bf712049ada088fa6b84ad5de7433be64
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.263rc202609231741-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-manylinux_2_17_x86_64.whl
Size 52.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ecb1e2c411af9b95c4a9bbc358e4f437001abfd6dbe08a7a54e288a0a55ae41a
BLAKE2b-256 checksum
How to use checksums
2771764bf3170e75d2e2644ecdd62ecef2d67c2bc519f26982f9d1c7252f92b7
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.263rc202609231741-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-manylinux_2_17_aarch64.whl
Size 52.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
22c51abbd942f46a8109bbd0b8b74b99992c0dbb727be28fb872767b398ebe9e
BLAKE2b-256 checksum
How to use checksums
8a2caf511a4e276211a5408305669d5a0c16e368f057ac1c6d469d5bbd1d2e22
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.263rc202609231741-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-macosx_11_0_arm64.whl
Size 42.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bba78c32b03b7fabba7467406bb414697798de4a9c37ead133f65daf8f326803
BLAKE2b-256 checksum
How to use checksums
31d579c48fa24f44360e21d405844b72cfd336799b9763ad5f566945b065b7e6
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.263rc202609231741-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.263rc202609231741-py3-none-macosx_10_12_x86_64.whl
Size 45.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
964b64cc9c370975efc6515c23c7ae9f58a7ffee69edcac5cdf53ff08ba0ffd1
BLAKE2b-256 checksum
How to use checksums
15daf486c4b9117671fb334b7de220c7eb4637897bf4959f067bdba1a5bb0b26
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 history Release notifications | RSS feed

This release

0.0.1

2 release files

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