Skip to main content

BranchKit Plugin SDK (Python)

The Python SDK for building BranchKit plugins — processes (run under BranchKit's managed CPython) that add voice commands, window management, browser integration, or anything else to the BranchKit platform. MIT licensed. Feature-parity with the Go and TypeScript SDKs, verified by a shared conformance harness. Stdlib-only: importing the SDK forces no third-party dependency on any plugin.

Start here

Minimal plugin

import asyncio
import branchkit

plugin = branchkit.Plugin()

@plugin.handle_action("myplugin.greet")
async def greet(req):
    await plugin.input_type_text("Hello!")
    return {"status": "ok"}

asyncio.run(plugin.run())

Pair with a plugin.json manifest declaring the action and "runtimes": ["python"] (run: "python3 main.py") — see the tutorial. branchkit-gen generates typed params (TypedDict) and registrars from your manifest's action_types.

Handlers may be async def (run on the asyncio loop) or plain def (auto-offloaded to a worker thread, so a blocking body cannot freeze the plugin — use plugin.call_sync(...) there instead of await).

Key surfaces

Need API
Handle an action @plugin.handle_action("prefix.name") (alias @plugin.action)
Handle an RPC method @plugin.handle("my_method")
Listen for events @plugin.on(EVENT_COLLECTION_UPDATED)
Call the actuator generated wrappers (await plugin.collection_get(...), 600+) or raw plugin.call
State verbs plugin.get/list/put/patch/delete/replace/...
Logs (append-only) plugin.append/append_keyed/list_log/...
Mirrors plugin.mirror_collection(name), plugin.settings(name)
Commands branchkit.command(...) builder, push_command_group
Leveled logging await plugin.info(tag, data) (trace/debug/info/warn/error)
Local listener branchkit.listen_local(plugin) (serves inherited fds)
Outbound HTTP branchkit.UpstreamClient / urllib.request.urlopen (both proxy-aware)
Author tests branchkit.harness.Harness

Development

python3 -m unittest discover -s tests     # the SDK's own suite

The cross-language conformance suite lives in the app workspace (branchkit-sdk-test against sdk-test/testplugin-py). Generated files (*_gen.py) are emitted by emit-sdk — edit the inventory, not the files.

Metadata

Release files for branchkit 0.3.0

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

Source distribution (sdist)

Source distribution for branchkit 0.3.0
File Size Uploaded
branchkit-0.3.0.tar.gz 105.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for branchkit 0.3.0
File Interpreter ABI Platform
branchkit-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 212.2 kB

Release files / branchkit-0.3.0.tar.gz

Download URL branchkit-0.3.0.tar.gz
Size 105.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5829240bb6db481c2da1311225ade7eff436cccbcab8a84d7630396ea849035e
BLAKE2b-256 checksum
How to use checksums
eac89e2a7be62304ac88c69b854788d3de2d44b77a2d499cf6f8c19a868e4b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / branchkit-0.3.0-py3-none-any.whl

Download URL branchkit-0.3.0-py3-none-any.whl
Size 106.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bbed37b7dc35fdef5c0d5e258dffca31964c0bf855367a42206d41a01d7257f
BLAKE2b-256 checksum
How to use checksums
172b5f944e70af67dbbec23fd14da0ce52787da8328cf21a24fe30b0b665cfb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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