Favicon of BAML

BAML

An open-source programming language for AI agents that runs on macOS, Linux and Windows, with typed model calls, local tracing and built-in evaluations.

Screenshot of BAML website

BAML is a programming language for developers building AI agents, with typed model calls and local tracing built into the language. It runs standalone on macOS, Linux and Windows, or alongside an existing application. The language is open source under Apache 2.0, and works offline.

Its syntax resembles TypeScript, but types persist at runtime and the language excludes any and unchecked casts. Typed errors and static analysis help catch mistakes before a program runs. For model calls, developers define the expected inputs and outputs; BAML parses the response against those types and can repair malformed output. AI functions support streaming, batching, websockets and voice across model providers.

Every function gets a local trace and profile that agents can inspect. This gives developers a record of execution beyond the model call itself. Boundary Web Services is a separate cloud offering; the language, runtime and local tracing run on your own machine.

BAML also includes concurrency controls, retries, cancellation and sandboxing for agent workflows. Its testing framework accepts examples, datasets and production traces, and can grade AI functions across repeated runs rather than rely on a single result.

You can adopt it incrementally. Language bridges let existing projects call BAML functions and share types, generics and lambdas. Supported targets include Python, TypeScript for Node and the web, Go, Rust, Java, C#, C++ and Swift, with Kotlin support for Android and Swift support for iOS.

Similar to BAML