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.264rc202609241703

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

Total release size: 349.1 MB

Release files / codebuddy_agent_sdk-0.3.264rc202609241703-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-py3-none-win_amd64.whl
Size 56.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
3eb7be622325b21f30e6d87372fed8998eddb94b208b6397e82df5c8c1efa623
BLAKE2b-256 checksum
How to use checksums
87647e60a63db4455f9ffe109101b62f196efcc53987d655f4a65be0de21a74e
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.264rc202609241703-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-py3-none-musllinux_1_1_x86_64.whl
Size 50.0 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a244a9aa124bf9ec1949a5b671d69ae3a94f1b21aa06dec340a1b7e6db7b0804
BLAKE2b-256 checksum
How to use checksums
f7bf2361473a617ed9fb827d10c42b9a877c465ff1dcc0aa82d05e6f9d6a7ab4
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.264rc202609241703-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-py3-none-musllinux_1_1_aarch64.whl
Size 49.8 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0138cdcfcca37759481e55ea97fb6a39705bcd61d725a70b8fcee79a3905400f
BLAKE2b-256 checksum
How to use checksums
08309b41c85ae176b5f5f590c9af671b2682767d7f04a446699a1556d7c0fe12
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.264rc202609241703-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-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
8be93c24b8aa20bd3f7411ba127ef04e83e67865ba5d3197cba2f06cdf1bdd85
BLAKE2b-256 checksum
How to use checksums
6824b1de97cf59816430c5f03fd49f1ad24b7a3c6d5f52251c9fa282e5b578a5
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.264rc202609241703-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-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
0870491de9d4faaa14fc62b7271c93fbcb51e9d918c3b7763da843cb5c39171c
BLAKE2b-256 checksum
How to use checksums
2a4f3475a36467ef4dfb9f2f8c9ba8320ac2ea0d40f05087df9f033468e559c7
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.264rc202609241703-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-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
bf730b1cfcaa11a2606f852d63439bf3b4f3046eed0e6ce3dfab98210106e726
BLAKE2b-256 checksum
How to use checksums
bbef6b06b0cd169f7d23231d9ed4da92e23fc725400ac600351a9a1b9e409321
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.264rc202609241703-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264rc202609241703-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
6b49312fe21add760b5b4eb922daf44f7c12791c2327f94cd6d4ca821b6fdf95
BLAKE2b-256 checksum
How to use checksums
738914c2fa787547a6c1424532f52ec2327a9841c52378df6a8bd85961608a84
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