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

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

Total release size: 122.9 MB

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

Download URL baml_bridge-0.20.2.dev2026100600-cp310-abi3-win_arm64.whl
Size 15.7 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
c06574dc5f1a2c9e56c05c5ebcd64c8a392170dd5e0729c52fafc0de1d69e2b6
BLAKE2b-256 checksum
How to use checksums
59f714953f6d0e0567346ea71a5670517613c1fe03319acdbccabfa714c1acf1
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.dev2026100600-cp310-abi3-win_amd64.whl

Download URL baml_bridge-0.20.2.dev2026100600-cp310-abi3-win_amd64.whl
Size 16.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ee4bd22eb6149bcac7ea7588a88472c23b85ff83807273ba982f9f979ca6d730
BLAKE2b-256 checksum
How to use checksums
a9546ea243cf4893b7965c69057ef06573fceb7b9a83ed8bd51421079e59ee11
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.dev2026100600-cp310-abi3-musllinux_1_1_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100600-cp310-abi3-musllinux_1_1_x86_64.whl
Size 15.8 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
88696c298799f580ea2d5de69cf5aa60d77438a1c301b7fe25e436d94e7e8610
BLAKE2b-256 checksum
How to use checksums
f262bf030b705d1d3cfaaff86e82148db361930b126f9a1738c44b4fd2617948
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.dev2026100600-cp310-abi3-musllinux_1_1_aarch64.whl

Download URL baml_bridge-0.20.2.dev2026100600-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
5c31adce270454a626a66f867a10522aa1457f7a22e2011d7f68017d60690ef2
BLAKE2b-256 checksum
How to use checksums
0a229168e8b9594faf2fa2a6fefdf1810c601829ef2b932ee22e9bf2c4696387
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.dev2026100600-cp310-abi3-manylinux_2_24_aarch64.whl

Download URL baml_bridge-0.20.2.dev2026100600-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
65c04b6766c818e42a78c4143dbee1568d029bb7c4f865339988685d607a9b2b
BLAKE2b-256 checksum
How to use checksums
20ee76348996218f2ce95fce2dea12d36159f72d2ecf7f059c9975fdce75d6ee
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.dev2026100600-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100600-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
3c8280b7a1965b8ac1aae5cdf6d18c074ddaea952eac39dd3a1eed60c471e675
BLAKE2b-256 checksum
How to use checksums
3df36daeeafce5eb01eadf9ec46a28a56eb20a406cef64f0361230e8c90f2a03
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.dev2026100600-cp310-abi3-macosx_11_0_arm64.whl

Download URL baml_bridge-0.20.2.dev2026100600-cp310-abi3-macosx_11_0_arm64.whl
Size 14.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c5d046792362a644a2d9db3e82e1c3325cf71f791745aa2edbc37129bb80f30e
BLAKE2b-256 checksum
How to use checksums
5bb146db5f05d6c7002ade8ecf6949480ba98796d87c73cd4f72215fcd24fdd9
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.dev2026100600-cp310-abi3-macosx_10_12_x86_64.whl

Download URL baml_bridge-0.20.2.dev2026100600-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4ba8896ef86d2ca2c9a250f7c320236ef2cbbe5bf7fb0b0a016fdb65d2005821
BLAKE2b-256 checksum
How to use checksums
1e9db7d2d558976ace16430feff2b916698ff5a22d2cda1059add2d8ed095a9f
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