BAML is a domain-specific language designed to make prompt engineering easy by turning it into schema engineering.
What is BAML?
BAML (Basically a Made-up Language) is a simple prompting language for building reliable AI workflows and agents. Instead of wrestling with f-strings and JSON schemas, BAML lets you focus on what matters: the structure and logic of your prompts. You don’t need to write your whole app in BAML - only the prompts! BAML generates type-safe client code that works seamlessly with your existing Python, TypeScript, Ruby, Go, or REST applications.Core Philosophy
The fundamental principle in BAML is simple: LLM Prompts are functions. Every prompt is a function that takes in parameters and returns a type.Key Features
Test 10x Faster
Built-in VSCode playground lets you test prompts directly in your editor with hot-reloading, no manual JSON schemas needed.
Fully Type-Safe
Get autocomplete and type safety in Python (Pydantic) and TypeScript, even when streaming structured data.
Works with Any Model
Supports OpenAI, Anthropic, Gemini, Vertex, Bedrock, Azure, and anything OpenAI-compatible (Ollama, OpenRouter, VLLM, etc.).
Reliable Tool Calling
Works even when models don’t support native tool-calling APIs using our SAP (schema-aligned parsing) algorithm.
Easy Model Switching
Switch between 100s of models in just a couple lines. Built-in retry policies, fallbacks, and round-robin.
Beautiful Streaming
Generate streaming UIs with fully type-safe partial responses. Includes React hooks for NextJS.
Use BAML from Any Language
BAML generates abaml_client that you can import into your application:
Built for Production
100% Open Source
Apache 2.0 license. Built in Rust for maximum performance.
100% Private
No network requests beyond your explicit model calls. Not used for training data.
Version with Git
BAML files live in your codebase and can be checked into Git for easy diffs.
Why BAML?
Just as JSX/TSX revolutionized web development by providing the right abstraction for UI, BAML provides the perfect abstraction for prompt engineering:- No more f-string hell: Write structured prompts, not string concatenations
- Schema engineering over prompt engineering: Define your output types, let BAML handle the prompt formatting
- Instant iteration: Test changes in seconds, not minutes
- Production-ready: Used by many companies in production with weekly updates
Try BAML online at Prompt Fiddle or explore Interactive Examples
Next Steps
Quick Start
Get BAML running in under 5 minutes
Why BAML?
Learn why you should use BAML over other frameworks