BAML is a programming language and toolchain aimed at code that agents write and edit alongside people. The syntax is close to TypeScript — unions, generics, and interfaces — but types persist at runtime with no any and no unchecked casts, errors are typed and statically analysed, pattern matching is exhaustive, and the filesystem defines modules and namespaces. Concurrency uses green threads with spawn and await.
The design goal is to make invalid states hard to represent, keep changes local, and expose nondeterminism, on the reasoning that an agent will eventually reach for any escape hatch a language leaves open. LLM functions, tests, testsets, and evaluations are language features rather than add-ons, and the standard library targets agent work directly.
The toolchain is built for machine callers as well as human ones: baml describe performs AST-aware code discovery, baml run executes any function from the command line, and baml agent install adds guidance matched to the version of BAML in the project. Adoption can be incremental — a BAML function can be called from TypeScript, Python, Go, C#, or Java through generated SDKs. The project is open source and pre-1.0, so some APIs and tooling continue to change.
Features
- TypeScript-like syntax: unions, generics, and interfaces in a familiar shape, compiled by a Rust-based toolchain
- Runtime types: types survive at runtime, with no any and no unchecked casting
- Typed errors: errors are statically analysed and matched exhaustively
- Green threads: colorless concurrency with spawn and await
- Native LLM functions: model calls, tests, testsets, and evaluations are part of the language
- Agent-facing tooling: baml describe for AST-aware discovery, baml run for command-line execution, and version-matched agent guidance
- Incremental adoption: generated SDKs let Python, TypeScript, Go, C#, and Java call BAML functions from an existing codebase
