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

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

Total release size: 120.9 MB

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-win_arm64.whl
Size 15.5 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
861b6202506d31ddb8b03861bea7aa8e1ca013bf6765c3088a52c83c45e731a4
BLAKE2b-256 checksum
How to use checksums
6db1279886370a460bb4a6316d568b4f135228fffe52321e0b43da145db36658
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-win_amd64.whl
Size 16.5 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
323e82fd9f483d78077353d8f0b46aa8823404561700a582a5ead00c758215f0
BLAKE2b-256 checksum
How to use checksums
d2872b82533aba540a9096ad10e94a28c91914b9882c2c44e7d1c5c12d1defd5
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-musllinux_1_1_x86_64.whl
Size 15.6 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
a2c1c53922171958afa2338c059e5088aa3b382c4b59943997f6250c5510202d
BLAKE2b-256 checksum
How to use checksums
46ff2181f725094b4fa1411cc5914b2017b03b4f2ab148f4fadad331a9c80883
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-musllinux_1_1_aarch64.whl
Size 14.5 MB
Tags CPython 3.10 Linux musl 1.1+ ARM64 abi3
SHA-256 checksum
How to use checksums
9f16e3c31558e11296dcf6cda1a1b55b0c922ab5b0b1a7277c21491a99d09e84
BLAKE2b-256 checksum
How to use checksums
c5aac5f3df895b7978e23bd6669a7f25db8bd8641e0b66c42ad30def46d746f7
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-manylinux_2_24_aarch64.whl
Size 14.3 MB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 abi3
SHA-256 checksum
How to use checksums
25ce734880037c7888f83a013dc5fafb0c0e3e2b9b5d403b8f6615ff1143861d
BLAKE2b-256 checksum
How to use checksums
1a6291989f5a64a398093abfc044d489429381d7b7577bec3c94f141ca0ed3a8
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 15.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
93a5ebec247fc9ad00cd4f0101bc4c81848b2cfc71c3c5cfa4de7b8c184ae0cb
BLAKE2b-256 checksum
How to use checksums
4ddefb7bcc31bdce846c94e3b38199bc038861a8cf718281325a0cce27b547d7
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-macosx_11_0_arm64.whl
Size 14.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4b84bdbbcffedb0834c9f114691de555c0d47916985f59be0b481ad631e59172
BLAKE2b-256 checksum
How to use checksums
765956c19bed12ae5ab35a59b0067d20b9ab7f8f7a149586214d95d2ca51760a
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 5, 2026.

Transparency log

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

Download URL baml_bridge-0.20.2.dev2026100400-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0d8f3eac1a755ca4dbb36a23d3ab95a042b7cfaa5ad383a4cc0fe53ee71cf20f
BLAKE2b-256 checksum
How to use checksums
4f9d728c9c2f2334234366368560bd78998b3283dbdb0173835659a109692afc
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 5, 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