Skip to main content

What is BAML?

BAML (Boundary AI Markup Language) is a domain-specific language for building type-safe LLM applications. It provides structured extraction with automatic validation and retry logic.

Installation

Setup

1. Create BAML Files

Create your BAML schema in baml_src/main.baml:

2. Configure Generator

Create baml_src/generators.baml:

3. Generate Client

Basic Usage

BAML clients are code-generated per project and cannot be auto-instrumented. You must call instrument_baml(b) after init(), or BAML calls will not be traced.

Async Support

BAML async functions are fully supported:

Complex Types

BAML excels at structured extraction with nested types:

What Gets Captured

For each BAML call, RDK captures:

Error Handling

BAML provides validation errors for malformed responses:

See Also