Skip to main content

baml_bridge

Python bindings for the BAML runtime (powered by bex_engine).

baml_bridge is the bridge layer that generated baml_sdk packages import at runtime: it provides the BamlRuntime singleton, the protobuf encoder/decoder and the function/method factories.

from baml_bridge import BamlRuntime

rt = BamlRuntime.initialize_runtime(
    root_path=".",
    files={"main.baml": baml_source},
)

This package is generally consumed indirectly via the code generated by baml-cli generate --target python — direct use is reserved for runtime authors and bridge tests.

Python callback execution

Passing a Python callable to BAML uses the environment of the call that invokes it. Reusing a callback across threads, event loops, or requests does not retain its registration environment.

BAML entry Python callback Execution environment
Synchronous Synchronous Calling Python thread, with its current context
Synchronous Coroutine result Bridge-owned worker loop, with copied caller context
Asynchronous Synchronous or coroutine result Originating application loop, with copied entry context

Each dispatch of an async entry receives a separate copy of its application ContextVars. Callback writes do not change the awaiting task's context or another dispatch's context. An async callback need not run in the caller's exact asyncio.Task.

A synchronous entry blocks its calling thread, including any application loop running there. Coroutine callbacks of that entry must use resources of their executing worker loop. Awaiting resources owned by the blocked loop is unsupported.

Returned BAML closures support closure(...) and await closure.call_async(...). Passing a closure back into BAML preserves its native function handle. Each new invocation selects its own environment.

Cancelling a BAML call cancels executing coroutine callbacks on their owning loops. Callback tasks retain their arguments and context until their bodies and async cleanup finish. Cancellation does not interrupt a synchronous Python body. A callback that suppresses cancellation may finish later; its result does not revive the cancelled BAML call.

Requirements

  • Python 3.10+
  • protobuf >= 6.31.1

License

Apache-2.0

Metadata

Release files for baml-bridge 0.23.0

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 baml-bridge 0.23.0
File Actions
baml_bridge-0.23.0-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for baml_bridge-0.23.0-cp310-abi3-win_arm64.whl
baml_bridge-0.23.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for baml_bridge-0.23.0-cp310-abi3-win_amd64.whl
baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_x86_64.whl CPython 3.10 abi3 Linux musl 1.1+ x86-64 Details for baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_x86_64.whl
baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_aarch64.whl CPython 3.10 abi3 Linux musl 1.1+ ARM64 Details for baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_aarch64.whl
baml_bridge-0.23.0-cp310-abi3-manylinux_2_24_aarch64.whl CPython 3.10 abi3 Linux glibc 2.24+ ARM64 Details for baml_bridge-0.23.0-cp310-abi3-manylinux_2_24_aarch64.whl
baml_bridge-0.23.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for baml_bridge-0.23.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
baml_bridge-0.23.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for baml_bridge-0.23.0-cp310-abi3-macosx_11_0_arm64.whl
baml_bridge-0.23.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for baml_bridge-0.23.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 128.7 MB

Release files / baml_bridge-0.23.0-cp310-abi3-win_arm64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-win_arm64.whl
Size 16.4 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
b897c0c5051f630795c587bcb419d9958c8c1149fd28cc46eaff533bc91d19ca
BLAKE2b-256 checksum
How to use checksums
bb0ba780ede7926a61a390ea1c1047c4eacd75cf494431ec0ad0ea290ea5cdfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-win_amd64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-win_amd64.whl
Size 17.6 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1392b0bc8375cd4fcf3d3c49fc33c5f38136df8987cf97a9940d955499f0f2ea
BLAKE2b-256 checksum
How to use checksums
f838a2c6351ebc004ade72734477b1f09b1b31fa676fdae476360b4277400203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_x86_64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_x86_64.whl
Size 16.6 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
d103c80419c8c74c13d409c3adef067bf0eeac197f9ab8f157ab56145b77ed88
BLAKE2b-256 checksum
How to use checksums
54ee6ffef14068bf8036384fc55613dccad94ef088708093b3f79740774665fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_aarch64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-musllinux_1_1_aarch64.whl
Size 15.5 MB
Tags CPython 3.10 Linux musl 1.1+ ARM64 abi3
SHA-256 checksum
How to use checksums
86a270e38f9a84f26faf3bf704942a20addd2f5fcd66e2711546d00397c4a9e0
BLAKE2b-256 checksum
How to use checksums
a5fe58b81f44e235eeade17c4b37a76b2e893826cbecee6eeba100d0b8b82e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-manylinux_2_24_aarch64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-manylinux_2_24_aarch64.whl
Size 15.3 MB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 abi3
SHA-256 checksum
How to use checksums
50866a8799512c084588d3829320353df807665de9d0f435057836ab5e02ae33
BLAKE2b-256 checksum
How to use checksums
f59e7c09c4099d53265eb4519dd1b3af49a0b5b0171d4249a143459a34e9a6e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 16.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5db87e41702a6d61bc7d86004ba1950c00d2e01241d55a044a251af0931e8bd3
BLAKE2b-256 checksum
How to use checksums
24a318b9d21e2d0e26e5434c6072de8751a7c28f305b25d57d4be892ef5cf4e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-macosx_11_0_arm64.whl
Size 15.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a26dd8845a4f4bab1a3422f34da79d84971535b6f682b8c9c9edc9917f5880da
BLAKE2b-256 checksum
How to use checksums
ec590687ff0f0955d2ce5ff7487a4df53ec9e120c7ed42cfcf14f6201f1737e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / baml_bridge-0.23.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL baml_bridge-0.23.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 16.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
374e4198932e0e700f49caa05a243aa2555acd9a7ca7a83c9a7c0a704c1c0831
BLAKE2b-256 checksum
How to use checksums
aeed3e6972fc5b039d2d2d251e8d4b75cc8ec27e7276c679caf4055612a46907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for baml-bridge 0.23.0

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for baml_bridge-0.23.0-cp310-abi3-win_arm64.whl

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 Oct 26, 2026.

Transparency log

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.23.0 This release

8 release files Full 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