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

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

Total release size: 349.2 MB

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

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

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
89005f5e476f2e67b2320bfae03659efb78965f5fa24642a68825df708a55e5f
BLAKE2b-256 checksum
How to use checksums
6b76ec095f0920e896d3d7aa5c3ef230bb32fca21cd2107f55a385e5f317adac
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.264.dev202609242120-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
3f4292dd180030fec8396fe986fd8d85507ed549170e5c64c5baee49c2459367
BLAKE2b-256 checksum
How to use checksums
5a0b35810e4f2ed38fdbc65daa8689fd851447613789e5a9fe2eef750f4e3938
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.264.dev202609242120-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
0ad939bdb601ebc00fe40c110d727c50aa040c97cc60a8b73a4bd534370c65a6
BLAKE2b-256 checksum
How to use checksums
f98251d9adfd81f4ed05b8bcce06a3ed057f8b2fba5929b279cda1ca1c316851
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.264.dev202609242120-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
ea4517ab2797d69be926edec9a262cdeb0705ccd3daf997915e17359888ddd4f
BLAKE2b-256 checksum
How to use checksums
ccc8f3344c4909cf08d4a804b8dd5884624f23433e084edee89f4ab8e2217a99
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.264.dev202609242120-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
aeacb10304e60c86c9382ccb4df74219060af0270d794e094292cdb6ea6973ea
BLAKE2b-256 checksum
How to use checksums
7680cd7da0e60a5ba9ddd9d85353370468968d1366f38684d1f6b3b3ff9799a2
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.264.dev202609242120-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.264.dev202609242120-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
ec638a138ab5d3b389fea4a33e40ff2b335b2969ef21fd89c96d2c6f8711c091
BLAKE2b-256 checksum
How to use checksums
b13eff6f1772b3a30924108b84d2f2f4fb1d3cfeb564ce07bb165412778a1816
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