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.276.dev202610132034

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

Total release size: 387.4 MB

Release files / codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-win_amd64.whl
Size 62.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
24f926ad5a43f4e0123b4154ca669864eb996cd359df37247d8609f51ff7e4c1
BLAKE2b-256 checksum
How to use checksums
1b330cc5648e321f4d8ef807f033b02a395565837d02f365e6e867ce5437b4da
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.276.dev202610132034-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-musllinux_1_1_x86_64.whl
Size 55.1 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c98e626456bbd17fc8fc9030f93f796db59d1a3907891712bdfa682919cf67cb
BLAKE2b-256 checksum
How to use checksums
dde2edf364f9568f048460e673024574b86389210a8d6974d18bd404a8fa51be
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.276.dev202610132034-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-musllinux_1_1_aarch64.whl
Size 54.6 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1c6c69556b3e6dba0ec206a2eaaf69ed69fc22870e168291a2d43e2200c943cc
BLAKE2b-256 checksum
How to use checksums
0accb4709a032b2811b2ca747cd0494657979abf1d0c84f67e4df8baa335c85f
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.276.dev202610132034-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-manylinux_2_17_x86_64.whl
Size 58.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
020e963268500cca92421a2bd03d59992cfe3df12ef65d30eecb6fee357e9930
BLAKE2b-256 checksum
How to use checksums
550cc0dbd507f4798d36a863a10e9d05ee71f304756c5a867f98e29a1e505edc
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.276.dev202610132034-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-manylinux_2_17_aarch64.whl
Size 58.2 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
dc846266dd8e8462c2895bc518e44ec9a390ae0c1129b07e24db43054ac79a5a
BLAKE2b-256 checksum
How to use checksums
df3746b7733d6f55b231a40c67ab7091eaf1b4142347f5e312c05ce1499d1cb7
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.276.dev202610132034-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-macosx_11_0_arm64.whl
Size 48.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1446e343fb68053a55c4f3a056eca1d27002eae71443fc843cb60a3254386051
BLAKE2b-256 checksum
How to use checksums
67be83e8465e428715b9f1ad4c53803753062156b980f2d5df82ffb6424f9f30
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.276.dev202610132034-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.276.dev202610132034-py3-none-macosx_10_12_x86_64.whl
Size 50.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c69378d2eef1daa31490dfa6cb2b683ee66d5a6fcac89b36ede1736c0e5e9bbf
BLAKE2b-256 checksum
How to use checksums
c91e16319a01a886c51babb15e8d527f711b1df21c460e389ca74ac37359f7fa
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