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)

Related Links

Feedback

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-win_amd64.whl (48.7 MB view details)

Uploaded Python 3Windows x86-64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_x86_64.whl (44.0 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_aarch64.whl (43.8 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARM64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_x86_64.whl (45.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_aarch64.whl (45.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_11_0_arm64.whl (34.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_10_12_x86_64.whl (36.9 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-win_amd64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-win_amd64.whl
  • Upload date:
  • Size: 48.7 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 081b897da913172e1efb1aac086d12c104868d29b3d836acebaf587517d5e45d
MD5 6c5eca828af5daeb238c3c50a9a03a53
BLAKE2b-256 a6fac3cade0ffb57fefe7d8ea4bdbfe55028a6668c88bfffbeceb967cafb7d61

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 44.0 MB
  • Tags: Python 3, musllinux: musl 1.1+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 bb0aab4868de230eacdbb43bb7c94bb471dcf6ebab3295615520494f5aeb0b2e
MD5 e1cfcf3215985867ce189a4c999b2ea8
BLAKE2b-256 338889a42489923cbe13e186c770fb01481163259100e1a91a26f0f7304c4163

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_aarch64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 43.8 MB
  • Tags: Python 3, musllinux: musl 1.1+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 6e2298f3100e76315b05f0abf6488e4df4c1feba753e03931157441c4afdf708
MD5 631c4c1831e570991a7f38d0da9563f8
BLAKE2b-256 551ca15e7cfe6978df9c9ceb5c3fd17f5a1849075bbe4987f3f56de9cac4bb8e

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 45.6 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b30aa1b01888b9f9d02e0bcd77c05d708c6a83d507b21a884858141f5b20f8cf
MD5 be8173bd223d7b2eb5b20dd963311214
BLAKE2b-256 05bd7d3c1990ae6157b5c7a7a53ea87f8f34c6367047bcfdf3f1a188cba8387c

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_aarch64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_aarch64.whl
  • Upload date:
  • Size: 45.2 MB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 6410400db82cfbfe6b405375c2a1d7006f036874592a14c3277fcca35eecf989
MD5 7ab477391442f2444c1cd8c033d06031
BLAKE2b-256 fca71e33dbb46bedbec42d5afcbc19dd584edd5592831750162463113a233042

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 34.3 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2555fce749b681f2ef3d22f6c1fdf61aaa080663bf025b778978510c5aa6ded
MD5 21c94dd6afd73fd6ad6fbaefc93a768d
BLAKE2b-256 0e993ec8c90f76b4859216c47e6dd184a5e712f0bdd126891c79740fac1472c5

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 36.9 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}

File hashes

Hashes for codebuddy_agent_sdk-0.3.236.dev202608122102-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a6c56cb94840c3201ecd0c38ac32027328f16475b05d9d3a0ad44376eac14d7f
MD5 1271a69a61437687a44242c679b9d05e
BLAKE2b-256 494e16d238ab0269055610d6edd14d2c8a6207c37ba203eefa3b9946dd94c4aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page