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

Uploaded Python 3Windows x86-64

codebuddy_agent_sdk-0.3.240-py3-none-musllinux_1_1_x86_64.whl (47.6 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

codebuddy_agent_sdk-0.3.240-py3-none-musllinux_1_1_aarch64.whl (47.4 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARM64

codebuddy_agent_sdk-0.3.240-py3-none-manylinux_2_17_x86_64.whl (49.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codebuddy_agent_sdk-0.3.240-py3-none-manylinux_2_17_aarch64.whl (48.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codebuddy_agent_sdk-0.3.240-py3-none-macosx_11_0_arm64.whl (38.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codebuddy_agent_sdk-0.3.240-py3-none-macosx_10_12_x86_64.whl (40.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-win_amd64.whl
  • Upload date:
  • Size: 52.4 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.240-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5e379f374f0db01bd127829daf6b55ef8ce4f067761e1d25573fc76d610abe58
MD5 f1ac157d395ca38ddfab056cedfe73ea
BLAKE2b-256 64ffc41e29083c431e0158b95fefb72dd58aaf8067b8ccbdb7df8d9c75402755

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 47.6 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.240-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a3a6634eb3db2478de4ef58e93587e2aa910f7fe086ccdcf5f5d18aae2b07d57
MD5 9fbf5b8cef3735591cb687b2f679ebcb
BLAKE2b-256 41c8787513bfb5bb2f34307993c92cc78dc4b5f2f366375ca8752979dca68ea6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 47.4 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.240-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 ef6c1f9b1a4ab0e39e872e40d6121e550d555a2255f5f5bbf7f2d80efd3ae632
MD5 05724fbf9cd9fb466eed56d5d7cc5374
BLAKE2b-256 6a23821ecce2126b2070515532a473b875cb319581cbfc95d540083d787b2ba6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 49.2 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.240-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bfe781298f9d503cddb271e08c595ee797939c20c2b164f244d63d86d5931b71
MD5 05598b369ad0eb23a5b07e6db45b1903
BLAKE2b-256 96baa710e2f1d1b23a9b93a88a58e0da10560185299476570bc26e16a7024352

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-manylinux_2_17_aarch64.whl
  • Upload date:
  • Size: 48.8 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.240-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 6b4b875f9986ccd6481fdc827f555e3bd04f40b434a04ce64bede6ae9f2f49d0
MD5 b6145a5abbe2433204691e948161aef5
BLAKE2b-256 d5853748b41ea7e7ea128a0347918e11b23377ce6064dd914949161bfda76982

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 38.0 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.240-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75455b69318a3169491ffe801955bafa95d0bceacf9e06eb4e319c0e356d546f
MD5 747648ed86fc887b9a0641500ce43716
BLAKE2b-256 8a0fd9e4ac38c611e1bd2bee634a053ab455db5bcd79df3043efe5b30b06777d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.240-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 40.6 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.240-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f24238c7b8d3bcbefb826194b7db15e1f4ba081a65d7ba6d9b215df16358f8db
MD5 479a5779c3efb53865849dbac0dc3962
BLAKE2b-256 39f701e03bec011991bf5126ffd402a9973d3c49bb55fba8b8be18f8f413eedd

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