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

Uploaded Python 3Windows x86-64

codebuddy_agent_sdk-0.3.236-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.236-py3-none-musllinux_1_1_aarch64.whl (43.7 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARM64

codebuddy_agent_sdk-0.3.236-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.236-py3-none-manylinux_2_17_aarch64.whl (45.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codebuddy_agent_sdk-0.3.236-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.236-py3-none-win_amd64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ee32ecfb733379ae3172b7add0fdfedde59593dd21f480b85f8a7c250b869374
MD5 9034d5d7b69b694891c97888178f3fe4
BLAKE2b-256 0a07378d8bdc540fba75b103639ec245a7b959a60bbbd800eba7fd64c792fdae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 20c89271adb7e7680da1de7905f6ab922f66ad80d1f49a01e1b5b94c20dcb7f4
MD5 7945bdd44862b9bc7e16e940529b3568
BLAKE2b-256 8afe3eb0fc2e4717ace5715789cacaab79d5808cc039e7ea6fe569702e1a01bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 3e9182098e8621616921712fbbb56771feb45de6dadc8c6e00c48d55b4f61a47
MD5 3058a2fe895568b1328907018a54d0f8
BLAKE2b-256 65851e92cebbbd17b7a4cb1a56b2beff78c8b5652fa191a58a033e90a1d1d182

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 30e599f7a27c1aef0ab06a228eae4c02f2893a622449e15fd8cf4bc0ecea2576
MD5 73ce5a6a18d80b6e7c952b0fc7a394d0
BLAKE2b-256 345e8c1c4aca05931d0d6150fea2f1c77fb2ef471baeff1446aaea07d2885a1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 0d4d94fe17507bd51b4db2170e30ae9eb165a92b8884ba6ca20f4de5b951e80a
MD5 8a68da9255fcafc0542276a696855235
BLAKE2b-256 c876af439dedf8b8e37f8122a9da0665958115002ffe86e23a4022653245bc4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74e38b03c9ee9e581a2fbb22ec5f59ad9e71be3e8ab00be90d5d2f74aa22a0b2
MD5 4b86e95f77d10a071897c7af8590e65c
BLAKE2b-256 a603a7a5dfbb63d962381051d40ca46135036dc80c49fb3c4bb53c822d172ef4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.236-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.236-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 eeca7c336e7ee4adddd37ef5811468a8be9bbc2d7eb6788be5e9124a6d82a457
MD5 c3aaf71a3c23715791abc0aad6a7b542
BLAKE2b-256 2236ce608f606af47aaba13c55125f07b8bca1f3e4c52703e076902b04c8f665

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