Skip to main content

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.238-py3-none-win_amd64.whl (48.7 MB view details)

Uploaded Python 3Windows x86-64

codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_x86_64.whl (43.9 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_aarch64.whl (43.7 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARM64

codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_x86_64.whl (45.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_aarch64.whl (45.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codebuddy_agent_sdk-0.3.238-py3-none-macosx_11_0_arm64.whl (34.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codebuddy_agent_sdk-0.3.238-py3-none-macosx_10_12_x86_64.whl (36.8 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-win_amd64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-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.238-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d6c6598ae4fee56a04451d1b71629e42ee50ce3a3859f55aec3fb95b0ab76f88
MD5 263cd9071f14eb4295d4fbfd1df0dfd1
BLAKE2b-256 14e905170b970f2eb6b2666dcbad9ee13d7a193ec30ee5181708bb54857fc937

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 43.9 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.238-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d879cece07b1a7553e0689fce80730fd89c5c5c41aab649ff59ba3a9fbb0c800
MD5 5345b8d90a08001c3938bfb19ce4ac60
BLAKE2b-256 9682771965ecb90eaa5d40fe286c35789c5de976cf913b69f34abd179c472550

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_aarch64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 43.7 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.238-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 b65e39fec391ea923d527fd063b591bbe3435bc8ab14c5f9b0276d13dd5e5a81
MD5 01b02032d233f43780665a68067a001b
BLAKE2b-256 61160a5a181666c21be7039396decc52bf2a5ebe4bf9f67ca2ab7acd434184b5

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 45.5 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.238-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 35712650955e46f77d214b3e2ec2960a51ddf505523eead96e132da539306384
MD5 17d263f7c0672b638fd112506f456c2c
BLAKE2b-256 fc39da2ed23757f505675e0251ce81dcdefbc71bb83eb6cd4898ffede30a7f6f

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_aarch64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-manylinux_2_17_aarch64.whl
  • Upload date:
  • Size: 45.1 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.238-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 eb84af43c17435fbebedb7b62cd396319863c572c6c521f09262defbe1190735
MD5 92072a6e5e47228abbb95aa515e67689
BLAKE2b-256 4baf60cacb955979da7ab342617ab7b755c18cd2a3862aad9253f93e5eb42d9b

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 34.2 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.238-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e97547ecf51bda9f37af66cd575c63b1c4a6d153271b8c787ee05c6a37c7bcda
MD5 2f39e0d51c59cc8036bb0ebde2180c1f
BLAKE2b-256 d6eb25e077e5df1c0a8fd6dac1e8342e12f08e83a65fb7c16010b75e48512227

See more details on using hashes here.

File details

Details for the file codebuddy_agent_sdk-0.3.238-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.238-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 36.8 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.238-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c9880bd7df80f040016e14baa111c75f860ed1246f9203f7a6e83487a9bbaca
MD5 cc1730461f1f8adcbd498fb9b544d6ae
BLAKE2b-256 2ca5f7387b0086cc1d15e90a17bab260ae6fcd1e180d6f8a41cca147ea2580d8

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 Pingdom Monitoring Sentry Error logging StatusPage Status page