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.22.3.dev2026101600

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

Total release size: 124.9 MB

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-win_arm64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-win_arm64.whl
Size 15.9 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
5dec295abc91b0f6296b1a59ae9bd959d9ed4e29384a1228a9e4f13b37743137
BLAKE2b-256 checksum
How to use checksums
f248367666c35b4d05469c094d47d0ac8e9ba3641410ff5fcb82066567c6a2d5
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-win_amd64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-win_amd64.whl
Size 17.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3e5cb51eacbc8b35455bdf54489d66e2941681e8cc011e20fb360f07197d990a
BLAKE2b-256 checksum
How to use checksums
1d0a85a608c2273607b610940e28f3ae4bb9c3875e5f423004dd6baf2abff355
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-musllinux_1_1_x86_64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-musllinux_1_1_x86_64.whl
Size 16.1 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
5a2b01358c27d29bcf84075a6e67361debe161c5cbbf8625752ff2fd7e17c055
BLAKE2b-256 checksum
How to use checksums
da73a2f5950faeafc96ca1b4bb7d078de9c94a741c953a07c8094a82e2f09132
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-musllinux_1_1_aarch64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-musllinux_1_1_aarch64.whl
Size 15.0 MB
Tags CPython 3.10 Linux musl 1.1+ ARM64 abi3
SHA-256 checksum
How to use checksums
2b9362068dbd9f3a790ab4b7eada6425a16af2e6726a9c6d6e05d13e32701db3
BLAKE2b-256 checksum
How to use checksums
20e577f5cede2db9e67d526c6f24006122f44e197a3b67c361cdabee9962b8e7
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-manylinux_2_24_aarch64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-manylinux_2_24_aarch64.whl
Size 14.8 MB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 abi3
SHA-256 checksum
How to use checksums
5b3e2f1fd3f71ef0f710f899c0ced41af95d34d68ca52a7688cce797c0fc31dd
BLAKE2b-256 checksum
How to use checksums
e6ffbdd633c0968802b7c055ea97815defa117a64815efa5fa59ec2421cf4be9
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 15.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
acad3e0b8f67ffe88092cbfaaba43f087c15c54be1d60b16cc352974f0bb42b9
BLAKE2b-256 checksum
How to use checksums
7bb0ee975ce7a9326e9d54942cf193fff92d91e75eba36f7290821c0a545dceb
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-macosx_11_0_arm64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-macosx_11_0_arm64.whl
Size 14.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
265ce389675d532cd646a55b69292013a0476d1632ed154fc8ab1686e67b23bd
BLAKE2b-256 checksum
How to use checksums
973a7a0df5df4c0317c1f47745d3c00a16f62f465d58c1d352f886a94df4c2ff
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 17, 2026.

Transparency log

Release files / baml_bridge-0.22.3.dev2026101600-cp310-abi3-macosx_10_12_x86_64.whl

Download URL baml_bridge-0.22.3.dev2026101600-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.5 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c880436c8368cd4b41806b219c7815bee59069efe2f4ac124d00dbfaff06de35
BLAKE2b-256 checksum
How to use checksums
4447840e3d57b36c2d9f3381acd79b19d7c12228a7323a01c9def363c5631ced
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 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.22.2

8 release files

0.22.1

8 release files

0.22.0

8 release files

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