Modern programming languages weren’t built for agents.
BAML is Basically A Made-up Language.
We designed it to fight slop. As you read the code, it should feel like TypeScript (unions, generics, lambdas), but with no escape hatches (like as any).
BAML has the:
syntax and readability of TypeScript
correctness and tooling of Rust
compile times and concurrency of Go
dynamism and nothing else of Python
The parts different from TypeScript are:
Every function traced and profiled, locally. Agents can read the traces.
AI functionsStreaming, batching, websockets, voice, any provider.
The anti-slop type systemNo any, no unchecked casts, no imports. But we did add pattern matching.
Compiles faster than Go, searches better than ripgrep, packs smaller binaries than Bun.
Workflow primitivesConcurrency, retries, cancellation, codemode, sandbox. It’s a lot, just read the code.
Better testingGenerate tests from data or prod traces. Grade flaky (AI) functions over many runs.
And, most importantly:
Incremental adoptionBAML runs standalone on:
macOS
Linux
Windows
or inside your existing projects in:
Python
TypeScriptNode
TypeScriptWeb
Java
C#
.NET
C++
Go
Rust
KotlinAndroid
SwiftiOS
PHPsoon
Rubysoon
But not JavaScript. Never JavaScript. Plz stop.
Type-safe like OpenAPI, but capable like FFI.
Observability and profiling
Agents write more code than any human can read. Telemetry is the only way to understand what happened. BAML traces every function instead of sampling a percentage. It’s 6x faster than OpenTelemetry in Rust, 200x faster in Python, and the traces 1000x smaller.
The field forgets as fast as it learns. 147 events dropped since you opened this page.
Nothing is forgotten.
Read more → How BAML keeps tracing fast enough to always leave on
AI functions
Calling a model should feel like calling a function, not wiring up an SDK. In BAML it’s a typed function: declare the input and output types, get structured data back. Malformed output gets repaired against your types by schema-aligned parsing, so every model gets better at structured output.
Read more → AI functions in BAML
The anti-slop type system
Every invariant you can’t enforce is one an agent will eventually violate. Start with type erasure: we don’t do it, so there’s no any or unchecked cast for a model to hide behind. In BAML, invalid states don’t compile.
interface User {name: string;email: string;}// 'as' is an unchecked promise the compiler believesconst user = JSON.parse(raw) as User;user.email.toLowerCase();
Read more → The BAML language
Agent-first toolchain
For decades, tooling was built for humans: LSPs, autocomplete, hover docs. It’s about time the real author of the code got fair treatment. An LSP for you, baml describe and friends for them. And a really fast compiler for both.
$ baml run mainCompiling 1 file(s)Compiled 1 file(s) in 1s"hi, world"$ baml run greet -- --name "hacker news"Greeting { message: "hi, hacker news" }$ baml run greet -- --helpfunction greet(name: string) -> GreetingOptions:--name <string># any function is a target; its params become --flags
Read more → The BAML toolchain
Workflow primitives
How has everyone accepted async as a good idea? Half your codebase ends up as two copies of the same function, one sync and one async. Like Go, BAML has green threads. Unlike Go, you can await what they return.
Read more → Workflows in BAML
Better testing
Engineers spent twenty years squashing flaky tests. Then AI made everything flaky. BAML tests can grade distributions. Cases can be hard-coded examples, golden datasets, or real prod traces.
testset "from object storage" {let res = baml.http.fetch("https://datasets.example.com/golden.csv");let rows = res.text().split("\n");for (let row in rows.slice(1, rows.length())) {let cols = row.split(",");test ("golden: " + cols[0]) {assert.equal(classify(cols[0]), cols[1]);}}}
Read more → Evals in BAML
elephants in the room
I’m hyped. How do I port my codebase to BAML?
Do not rewrite your codebase in BAML.
You can if you want. But we went the extra mile in the other direction: every type, every function, every method crosses the bridge to your language. Even generics. Even lambdas. Even tracing. Sht just works. Read more → Incremental adoption
Can models actually write BAML?
Decide for yourself. BAML reads like TypeScript and is already an official language on GitHub, so models should know most of it. We don’t leave the rest up to vibes. We measure how agents write programs: how long it takes, what it costs, how many turns.
baml describe wasn’t a coincidence. It’s a science.
And remember, today is the worst the models will ever be at BAML. Read more → Agent tries BAML
Is there an ecosystem?
npm install is-even. It depends on is-odd? That depends on is-number?! 🤯 We’re rethinking package management from first principles. For now, we’ve shipped a thorough standard library. For anything else, ask Claude to port what you need, or pass functions over the bridge.
Besides, no packages means no supply chain attacks. QED.
Are you trying to get bought by Anthropic?
No thank you.
The BAML language is and will always be open. Apache-2, free, works offline.
We make money on Boundary Web Services. Build the language, the runtime, and the tracing layer, and you can make things nobody else can. We think you’ll love paying for some of them.
Some of you may wish to build your own cloud. Good luck and Claudespeed.
For the rest, we’re launching with observability, and saving you from Datadog. Reach out if you want in early.
Try BAML
OTEL dropped 147 events while you read this page.
Book a free 45-minute session with the team. We'll get you set up and work through your actual use case.
Book a sessionJoin the BAML Discord. We're around to help you get set up, and we read every bit of feedback.
Join the Discord