Skip to content

BEP — BAML Enhancement Proposals

BEPs are design proposals for evolving the BAML language and core tooling.

Below is an auto-generated index of all BEPs.

⚠️ Do not edit the table below by hand. Run the BEP update script instead (see instructions at the bottom).

Status Meaning
Draft Work in progress, not ready for review
Proposed Ready for review and discussion
Accepted Approved for implementation
Implemented Feature is live in BAML
Rejected Decided against
Superseded Replaced by another BEP
BEP
BEP-001: Exception Handling   Proposed



Shepherd(s): Vaibhav Gupta
BEP-002: match   Accepted



Shepherd(s): hellovai , rossirpaulo
BEP-005: Prompt Optimization   Accepted

- `baml-cli` supports a new command called `optimize` that writes and improves prompts for you, similar to [DSPy](https://dspy.ai/). - Prompt optimization attempts to maximize the number of passing BAML test cases, and optionally minimize tokens and latency. - The optimizer is based on the [GEPA algorithm](https://arxiv.org/abs/2507.19457), which is partially encoded as BAML functions that you can tweak.

Shepherd(s): Greg Hale
BEP-006: compiler-errors   Draft

Uniform user-facing experience for compiler errors.

Shepherd(s): Greg Hale
BEP-007: Mid-level Intermediate Representation (MIR)   Draft

This proposal introduces a Mid-level Intermediate Representation (MIR) between THIR and bytecode generation in the BAML compiler pipeline. MIR is a Control Flow Graph (CFG) based representation that simplifies the compilation of complex control flow constructs like `match` statements and error handling (`catch` expressions). By lowering high-level constructs into basic blocks connected by explicit jumps, MIR bridges the semantic gap between the tree-structured THIR and the linear bytecode, making codegen simpler, more maintainable, and easier to extend with new language features.

Shepherd(s): Antonio Sarosi
BEP-008: Function and Lambda Syntax Design   Draft



Shepherd(s): Language Design Team
BEP-009: Function and Lambda Syntax Design (TS-aligned)   Proposed



Shepherd(s): Language Design Team

Management

Scripts are self-contained Python scripts using uv. Ensure uv is installed.

Creating a new BEP

To create a new proposal:

mise run bep:new -- "Feature Name"

This will: 1. Create a new directory beps/BEP-XXX-feature-name/ 2. Create a README.md template inside it with the next available BEP ID.

Updating the Index

After modifying any BEP, update this README table:

mise run bep:readme

Managing BEPs

To update a BEP's status or timestamp:

Touch (Update Timestamp):

mise run bep:update 001
# OR
mise run bep:update BEP-001-exceptions

Change Status:

mise run bep:update 001 --status Proposed
(Valid statuses: Draft, Proposed, Accepted, Implemented, Rejected, Superseded)