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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.1+ ARM64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codebuddy_agent_sdk-0.3.237-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.237-py3-none-win_amd64.whl.

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 33d09f8302fc98971b6801aa023ab24296c69e90d3a4f5b3b1c39137681917ce
MD5 bc5ebed51f2d9ec5f0ccdb898813f3bd
BLAKE2b-256 4f10e5d75342240b3f88ee13147e548d43bd135085289ca88079a5f0a1de8dfb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 db2bd9c17e185b9cecc04ea3e942b27889194d22e508199eff272febd6588c3d
MD5 012f3914e62850640f363aca53419c0b
BLAKE2b-256 c6a57a30d88c864f564621893a1543db61b836fb1d084eb61dd481585e8076e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 b224e5851517702a06ffaef9cdd6a281ec952671b2a91e600edf0b61b1c4d749
MD5 0cc77fe5de5fdde90f91986c7217cd52
BLAKE2b-256 ed33cbadca0522d9fba96aa23ccf0ca5ab4876d367d546da305aa15615b8310b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 be3fe95a7407c4a833eba615de2f493eab9eff80f7b24194fa6445250d6b43f0
MD5 de80ca0216f8fc1ea411e0b8885f4fec
BLAKE2b-256 05421c7ea7f42e4b2c6ef87a2b4b4f9264c053b39a3209f004fb3d1520800b2c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 ad4c0059ebf82d88d6be906d6f3be9ec8ec4e95c7f60b142187b8c237f92c59b
MD5 ee7f030074d4468a84646310de7aaefd
BLAKE2b-256 2c70226ee10e0b61ed9e73d9258d6596fcccceb4919b95f2c270c268ad240070

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16205c6471b56d783073e42845700cfc94db36e1c55418fb11f5de148ab97164
MD5 af21f85b7fdc93db1c0b9badeadcb451
BLAKE2b-256 e0d6f2d4b71741daa20784bad2613866d641b3aa1f6e8008560f705be8f1aec1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codebuddy_agent_sdk-0.3.237-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.237-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 686ca07d248b90d910c2644b74cbf2ef6b3d31bf9a553f089d26ea712c41d631
MD5 9d20c33faab602e413ad542d34cfc493
BLAKE2b-256 85e010d5d36311ae5d16eda8fb04a111cc23a6c4f2aaacf9209c57bf6f66409c

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