Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.20.2.dev2026100602

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

Total release size: 123.2 MB

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-win_arm64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-win_arm64.whl
Size 15.8 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
050bf47d8d390d4e6acb8556dc684440377348710b41252bb5d319bf6811efc1
BLAKE2b-256 checksum
How to use checksums
164c1ff4045ef1e8f9a4d42df088e7024cb23f3c3f39f00122d8701ae41afdf9
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-win_amd64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-win_amd64.whl
Size 16.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8c9d9a4711fbe8cb744324d2e0a1a53273891b30095735cdfe8f4c87516240c0
BLAKE2b-256 checksum
How to use checksums
1180b2be3e67b5fc1e64b0687f1c86bc82d3d17029719cc80d302757a026a100
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-musllinux_1_1_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-musllinux_1_1_x86_64.whl
Size 15.9 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
cf36311f5fecb4c4eb45a586255e96c0e01aeb00b3ca6aa7b6f4c2f85bd7b6b0
BLAKE2b-256 checksum
How to use checksums
29d564fe37540803129e6ea90065e0652332861eefaf92190c01eed1b495f372
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-musllinux_1_1_aarch64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-musllinux_1_1_aarch64.whl
Size 14.8 MB
Tags CPython 3.10 Linux musl 1.1+ ARM64 abi3
SHA-256 checksum
How to use checksums
35b9ba0f1f6b52c3e5c9ee7597eac33e6f5a9cf732f2c9457b91535409dae0f5
BLAKE2b-256 checksum
How to use checksums
95f8a5ff48514f16d0bd940c554b57f25ff497dde4d09ce89adde83a823fa7bf
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-manylinux_2_24_aarch64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-manylinux_2_24_aarch64.whl
Size 14.6 MB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 abi3
SHA-256 checksum
How to use checksums
a8771b7b612abadc8ddf5971da995ee19504843f60b3ec339150d43f3479b8da
BLAKE2b-256 checksum
How to use checksums
a6b8424d1630baefad62de8ad7952c9d5b943f83497e51d6c971aa6776079aa1
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 15.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e69bb6c2414f9d826bf759cece9fe35e214ce3921b6c7928168e5630ed99fa3e
BLAKE2b-256 checksum
How to use checksums
ac093d61760e31586912fe2de71993630f86a6d3231d0cc50d499ba9af6e8c4d
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-macosx_11_0_arm64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-macosx_11_0_arm64.whl
Size 14.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f5cfd7c6254c05338699298575fe9d8dbd1e6a70641e45d56969203effb07c85
BLAKE2b-256 checksum
How to use checksums
3b2730855fb3e31c3a264ea5e982aa113e56f8c8b35fbc7e6241fc4f12508e1d
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 Oct 7, 2026.

Transparency log

Release files / baml_bridge-0.20.2.dev2026100602-cp310-abi3-macosx_10_12_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100602-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1d2e042ed8dd958620d8516f0317cfb8bee61f524dc376ba844ee2ebe4869e8d
BLAKE2b-256 checksum
How to use checksums
efa7eddf8ade7cf1dfb53dff7a68ff26f5babe394b89e997ae7e8cd6d6077db4
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 Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.22.2

8 release files

0.22.1

8 release files

0.22.0

8 release files

This release

0.20.1

8 release files

0.20.0

8 release files

0.19.0

8 release files

0.17.0

8 release files

0.16.0

8 release files

0.15.0

8 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