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.299

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.299
File Actions
codebuddy_agent_sdk-0.3.299-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for codebuddy_agent_sdk-0.3.299-py3-none-win_amd64.whl
codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_x86_64.whl Python 3 none Linux musl 1.1+ x86-64 Details for codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_x86_64.whl
codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64 Details for codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_aarch64.whl
codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_x86_64.whl
codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_aarch64.whl
codebuddy_agent_sdk-0.3.299-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for codebuddy_agent_sdk-0.3.299-py3-none-macosx_11_0_arm64.whl
codebuddy_agent_sdk-0.3.299-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for codebuddy_agent_sdk-0.3.299-py3-none-macosx_10_12_x86_64.whl

Total release size: 470.2 MB

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

Download URL codebuddy_agent_sdk-0.3.299-py3-none-win_amd64.whl
Size 74.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ea0ac7dd46ed8c70927ddd2ee8b2a9a70600bb2b49c96edebf7c97c29f270d86
BLAKE2b-256 checksum
How to use checksums
29b14b4047ddada4c352f66fef5f1f8d715db78994c847481b67665f9cfcbc3b
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.299-py3-none-musllinux_1_1_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_x86_64.whl
Size 66.7 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2d874d309d91deb9f10283032d8b3c4948172af9e502f8656180ba751e834fba
BLAKE2b-256 checksum
How to use checksums
a4eb11c445c80a76c302871107f06d6792c86669a13c4a812cce80ef66a33e72
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.299-py3-none-musllinux_1_1_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-musllinux_1_1_aarch64.whl
Size 66.2 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
78c281127391e10d0fb945acce5bd17204bda4a28dfe033f8b79a893c56a8223
BLAKE2b-256 checksum
How to use checksums
2a20fee5d2a134717a7a7af59de0e2ffc435b326923d34274b3a598ded429d53
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.299-py3-none-manylinux_2_17_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_x86_64.whl
Size 70.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
88fc43ae4719d914ca24a684dc7f42b272dcc1afb053807b19e0207176fc4200
BLAKE2b-256 checksum
How to use checksums
8f5facc6c51f59db475a924de793173cd3bbf8402de967105d47cb0fe3186bfd
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.299-py3-none-manylinux_2_17_aarch64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-manylinux_2_17_aarch64.whl
Size 70.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
33edfc85458eabc499d991e16f33cefd78118f344d2a6273c5848a3b08c548e8
BLAKE2b-256 checksum
How to use checksums
631446d2bebf869ce9a7e56c8394e36ca3e1c0982a5d3ace39e58a07abb25766
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.299-py3-none-macosx_11_0_arm64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-macosx_11_0_arm64.whl
Size 60.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aaa9e0c95b98d6522f91974b90f2ae069edb62018a81f04db9382e76adedb0cf
BLAKE2b-256 checksum
How to use checksums
3b4002aafb530fa9c1a91a43d36671e256e93a6e0105a9fb91177da16851db77
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.299-py3-none-macosx_10_12_x86_64.whl

Download URL codebuddy_agent_sdk-0.3.299-py3-none-macosx_10_12_x86_64.whl
Size 62.9 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ed574367ec4a8cf890bd2b1c254d1866612ddaadb3d0d01bfd10ecc43a9463f0
BLAKE2b-256 checksum
How to use checksums
2882136a6254d1858ccdb75be8a5de01e30d7bf2e44db60a358f4dffd47ec2ef
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.299

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.299 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