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)

Feedback

Metadata

Release files for codebuddy-agent-sdk 0.3.301

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for codebuddy-agent-sdk 0.3.301
File Actions
codebuddy_agent_sdk-0.3.301-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for codebuddy_agent_sdk-0.3.301-py3-none-win_amd64.whl
codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_x86_64.whl Python 3 none Linux musl 1.1+ x86-64 Details for codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_x86_64.whl
codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64 Details for codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_aarch64.whl
codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_x86_64.whl
codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_aarch64.whl
codebuddy_agent_sdk-0.3.301-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for codebuddy_agent_sdk-0.3.301-py3-none-macosx_11_0_arm64.whl
codebuddy_agent_sdk-0.3.301-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for codebuddy_agent_sdk-0.3.301-py3-none-macosx_10_12_x86_64.whl

Total release size: 474.2 MB

Release files / codebuddy_agent_sdk-0.3.301-py3-none-win_amd64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-win_amd64.whl
Size 74.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d3e116dfd7a0c2ce4d3625a6df9bcd3560023d1633f42992489cb5ab875e4240
BLAKE2b-256 checksum
How to use checksums
7fb58753703c1fc8db6cd7755b6a28e1338019043d27101532fa48270c057214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_x86_64.whl
Size 67.2 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b44a7c89fe5dbebeeb5a69d1f9e67f91d3ae1b22df95767e22239674a7520b65
BLAKE2b-256 checksum
How to use checksums
dc17f78244cecc5f6b5b334c8884f75b14eba3274c903599e727e7d3f0db2dda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-musllinux_1_1_aarch64.whl
Size 66.8 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
6f33ac92a9111d9506636082aa5d0cdafb60543dfa2d73da42c7e677fae0eb7e
BLAKE2b-256 checksum
How to use checksums
9d8ae874348e9c17698161d457e6d57448f1d29fb132c8364f61fc6955336108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_x86_64.whl
Size 70.8 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0a77e371695378c5662fe1f81f2640f882406dc5e937ffdd3847af131e7c6a69
BLAKE2b-256 checksum
How to use checksums
8c288fc78cd223f0d26bcfe3055a31b7b3d14ef8c1216d0e0863597eec367ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-manylinux_2_17_aarch64.whl
Size 70.5 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
3e4e8ecb52283628150a21842fd0c076b89533434c1f7820e262b5a8da6654ef
BLAKE2b-256 checksum
How to use checksums
9aefa3c6ced708a9a1f74a0a3c6a5209a984cd65b6d536e86d15d5d66749fdeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-macosx_11_0_arm64.whl
Size 60.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e9733f6cc594f7e29dd474e6eabcf6908f8a58d43016dbe27e3421c3ed5cef42
BLAKE2b-256 checksum
How to use checksums
e5d48c92d8fe95b046e822ba3c2d510eaadcf787eec690464710af1b1564ac28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / codebuddy_agent_sdk-0.3.301-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.301-py3-none-macosx_10_12_x86_64.whl
Size 63.5 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5fc33eafa7b1aa82ef4e4061823febc6ef66ce535c6d5f71fc73aa16220746a7
BLAKE2b-256 checksum
How to use checksums
7dc037fb7bacd2af15f7d8e948ed1f8ec1b6fd1b46c514dbc1247f2370c7603f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Security for codebuddy-agent-sdk 0.3.301

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.301 This release

7 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page