DISCOVER THE FUTURE OF AI AGENTS

BAML

Added May 7, 2026
Agent & Tooling
Open Source
RustLarge Language ModelsSDKCLIAgent & ToolingModel & Inference FrameworkDeveloper Tools & CodingProtocol, API & Integration

A type-safe domain-specific language for LLMs that transforms prompt engineering into schema engineering, compiling to native-typed clients in multiple languages for reliable structured LLM output.

BAML (Basically a Made-up Language), developed by BoundaryML, is a type-safe DSL designed for LLM applications. Developers write .baml declarative files defining input/output schemas and prompt templates for LLM functions, which are compiled by a Rust compiler to auto-generate native typed client code in Python (Pydantic), TypeScript, Go, and more.

Core Capabilities

  • SAP (Schema-Aligned Parsing) Algorithm: Proprietary parsing algorithm for reliable structured output parsing even without native tool-calling support, compatible with JSON embedded with markdown, chain-of-thought, and other flexible formats
  • Fully Type-Safe Streaming Output: Partial types for streaming structured data with per-chunk auto-completion
  • Multi-Model Support: One-line client declaration to switch across OpenAI, Anthropic, Gemini, Vertex, Bedrock, Azure OpenAI, and OpenAI-compatible endpoints (Ollama, OpenRouter, vLLM, etc.), with built-in retry, fallback, and model rotation strategies, plus Client Registry for runtime dynamic model selection
  • Checks and Asserts: Output validation and assertion mechanisms

Developer Experience

  • VSCode extension (syntax highlighting, test Playground, prompt preview, auto-generate on save), Cursor extension, JetBrains IDEs, Zed, Claude Code support
  • baml-cli test testing framework with CI/CD integration and parallel test execution
  • Online Playground: Prompt Fiddle

Architecture Overview

ModuleLanguageResponsibility
BAML CompilerRustParse .baml files, type checking, code generation
baml-cliCLI tool (init, generate, test)
baml_clientMulti-langAuto-generated clients wrapping LLM calls, JSON parse fixing, error handling, retries
baml_languageLanguage server providing IDE language features
BEPSBAML Enhancement Proposals (RFC-like mechanism)

Engineering managed via pnpm workspace + turbo Monorepo structure, with Nix build support and Fern-based documentation.

Use Cases

Structured data extraction (resumes, PDFs), AI Agent building (chained BAML functions + state loops), Chatbot/RAG, multi-model A/B testing, streaming AI UIs (Next.js/React), enterprise prompt version management (in Git). BAML files can be version-controlled for prompt change diffing and review. Compiler and CLI run 100% offline with network requests only for model calls.

Installation Examples

# Python
pip install baml-py && baml-cli init && baml-cli generate

# TypeScript
npm install @boundaryml/baml && npx baml-cli init && npx baml-cli generate

# Go
go install github.com/boundaryml/baml/baml-cli@latest && baml-cli init
go get github.com/boundaryml/baml && baml-cli generate

Supported Host Languages: Python, TypeScript, Go, Ruby, Rust, Java, C#, Elixir (REST API).

Unconfirmed: Exact release date (CITATION.cff says 2024), Java/C# client maturity (possibly via REST API), Boundary Cloud feature scope, SAP algorithm technical report, performance benchmarks, production adoption cases.

Related Projects

View All

STAY UPDATED

Get the latest AI tools and trends delivered straight to your inbox. No spam, just intelligence.