baml: what it is, what problem it solves & why it's gaining traction
baml: what it is, what problem it solves & why it's gaining traction
What it solves
BAML is a prompting language designed to replace the messy process of managing prompts as raw strings (f-strings) in application code. It transforms prompt engineering into "schema engineering," allowing developers to define prompts as type-safe functions that return structured data, making AI workflows and agents more reliable and maintainable.
How it works
BAML treats every prompt as a function with defined input parameters and a return type. A Rust-based compiler translates these BAML definitions into a client (baml_client) that can be called from various languages like Python, TypeScript, Ruby, and Go. It uses a custom algorithm called SAP (schema-aligned parsing) to ensure reliable structured outputs even from models that do not natively support tool-calling APIs.
Who it’s for
Developers building AI agents and complex LLM workflows who want to type-safety, faster iteration speeds through IDE integration, and the ability to switch between different LLM providers without rewriting their application logic.
Highlights
- Type-Safe Structured Outputs: Returns data in defined classes/types rather than raw text.
- Cross-Language Support: Prompts defined in BAML can be called from Python, TypeScript, Ruby, and Go.
- IDE Integration: Native tooling for VS Code and JetBrains for rapid prompt testing and visualization.
- Model Agnostic: Supports a wide range of providers (OpenAI, Anthropic, Gemini, Bedrock, etc.) with built-in retry policies and fallbacks.
- Schema-Aligned Parsing (SAP): Enables reliable tool-calling and structured data extraction from any model.
- Open Source: Apache 2 license, private by design, and built in Rust for performance.
Sources
- undefinedBoundaryML/baml