freshcrate
Skin:/
Home > Frameworks > baml

baml

The AI framework that adds the engineering to prompt engineering (Python/TS/Ruby/Java/C#/Rust/Go compatible)

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

The AI framework that adds the engineering to prompt engineering (Python/TS/Ruby/Java/C#/Rust/Go compatible)

README

BAML Version

BAML: Basically a Made-up Language

BAML is a simple prompting language for building reliable AI workflows and agents.

BAML makes prompt engineering easy by turning it into schema engineering -- where you mostly focus on the models of your prompt -- to get more reliable outputs. You don't need to write your whole app in BAML, only the prompts! You can wire-up your LLM Functions in any language of your choice! See our quickstarts for Python, TypeScript, Ruby and Go, and more.

BAML comes with all batteries included -- with full typesafety, streaming, retries, wide model support, even when they don't support native tool-calling APIs

Try BAML: Prompt FiddleInteractive App Examples

The core BAML principle: LLM Prompts are functions

The fundamental building block in BAML is a function. Every prompt is a function that takes in parameters and returns a type.

function ChatAgent(message: Message[], tone: "happy" | "sad") -> string

Every function additionally defines which models it uses and what its prompt is.

function ChatAgent(message: Message[], tone: "happy" | "sad") -> StopTool | ReplyTool {
    client "openai/gpt-4o-mini"

    prompt #"
        Be a {{ tone }} bot.

        {{ ctx.output_format }}

        {% for m in message %}
        {{ _.role(m.role) }}
        {{ m.content }}
        {% endfor %}
    "#
}

class Message {
    role string
    content string
}

class ReplyTool {
  response string
}

class StopTool {
  action "stop" @description(#"
    when it might be a good time to end the conversation
  "#)
}

BAML Functions can be called from any language

Below we call the ChatAgent function we defined in BAML through Python. BAML's Rust compiler generates a "baml_client" to access and call them.

from baml_client import b
from baml_client.types import Message, StopTool

messages = [Message(role="assistant", content="How can I help?")]

while True:
  print(messages[-1].content)
  user_reply = input()
  messages.append(Message(role="user", content=user_reply))
  tool = b.ChatAgent(messages, "happy")
  if isinstance(tool, StopTool):
    print("Goodbye!")
    break
  else:
    messages.append(Message(role="assistant", content=tool.response))

You can write any kind of agent or workflow using chained BAML functions. An agent is a while loop that calls a Chat BAML Function with some state.

And if you need to stream, add a couple more lines:

stream = b.stream.ChatAgent(messages, "happy")
# partial is a Partial type with all Optional fields
for tool in stream:
    if isinstance(tool, StopTool):
      ...
    
final = stream.get_final_response()

And get fully type-safe outputs for each chunk in the stream.

Test prompts 10x faster, right in your IDE

BAML comes with native tooling for VS Code and JetBrains IDEs, with support for other editors continuing to expand.

Visualize full prompt (including any multi-modal assets), and the API request. BAML gives you full transparency and control of the prompt.

raw-curl

Using AI is all about iteration speed.

If testing your pipeline takes 2 minutes, you can only test 10 ideas in 20 minutes.

If you reduce it to 5 seconds, you can test 240 ideas in the same amount of time. resume-attempt2-smaller2

The playground also allows you to run tests in parallel -- for even faster iteration speeds 🚀.

No need to login to websites, and no need to manually define json schemas.

Enable reliable tool-calling with any model

BAML works even when the models don't support native tool-calling APIs. We created the SAP (schema-aligned parsing) algorithm to support the flexible outputs LLMs can provide, like markdown within a JSON blob or chain-of-thought prior to answering. Read more about SAP

With BAML, your structured outputs work in Day-1 of a model release. No need to figure out whether a model supports parallel tool calls, or whether it supports recursive schemas, or anyOf or oneOf etc.

See it in action with: Deepseek-R1 and OpenAI O1.

Switch from 100s of models in a couple lines

function Extract() -> Resume {
+  client openai/o3-mini
  prompt #"
    ....
  "#
}

Retry policiesfallbacksmodel rotations. All statically defined. Fallback Retry Want to do pick models at runtime? Check out the Client Registry.

We support: OpenAIAnthropicGeminiVertexBedrockAzure OpenAIAnything OpenAI Compatible (Ollama, OpenRouter, VLLM, LMStudio, TogetherAI, and more)

Build beautiful streaming UIs

BAML generates a ton of utilities for NextJS, Python (and any language) to make streaming UIs easy. recipe-generator

BAML's streaming interfaces are fully type-safe. Check out the Streaming Docs, and our React hooks

Fully Open-Source, and offline

  • 100% open-source (Apache 2)
  • 100% private. AGI will not require an internet connection, neither will BAML
    • No network requests beyond model calls you explicitly set
    • Not stored or used for any training data
  • BAML files can be saved locally on your machine and checked into Github for easy diffs.
  • Built in Rust. So fast, you can't even tell it's there.

BAML's Design Philosophy

Everything is fair game when making new syntax. If you can code it, it can be yours. This is our design philosophy to help restrict ideas:

  • 1: Avoid invention when possible
    • Yes, prompts need versioning — we have a great versioning tool: git
    • Yes, you need to save prompts — we have a great storage tool: filesystems
  • 2: Any file editor and any terminal should be enough to use it
  • 3: Be fast
  • 4: A first year university student should be able to understand it

Why a new programming language

We used to write websites like this:

def home():
    return "<button  class="pl-cce">\"() => alert(\\\"hello!\\\")\">Click</button>"

And now we do this:

function Home() {
  return <button onClick={() => setCount(prev => prev + 1)}>
          {count} clicks!
         </button>
}

New syntax can be incredible at expressing new ideas. Plus the idea of maintaining hundreds of f-strings for prompts kind of disgusts us 🤮. Strings are bad for maintainable codebases. We prefer structured strings.

The goal of BAML is to give you the expressiveness of English, but the structure of code.

Full blog post by us.

Conclusion

As models get better, we'll continue expecting even more out of them. But what will never change is that we'll want a way to write maintainable code that uses those models. The current way we all just assemble strings is very reminiscent of the early days PHP/HTML soup in web development. We hope some of the ideas we shared today can make a tiny dent in helping us all shape the way we all code tomorrow.

FAQ

Do I need to write my whole app in BAML? Nope, only the prompts! BAML translates definitions into the language of your choice! Python, TypeScript, Ruby and more.
Is BAML stable? Yes, many companies use it in production! We ship updates weekly!
Why a new language? Jump to section

Contributing

Checkout our guide on getting started

Citation

You can cite the BAML repo as follows:

@software{baml,
  author = {Boundary ML},
  title = {BAML},
  url = {https://github.com/boundaryml/baml},
  year = {2024}
}

Made with ❤️ by Boundary

HQ in Seattle, WA

P.S. We're hiring for software engineers that love rust. Email us or reach out on discord!

Release History

VersionChangesUrgencyDate
baml-wrapper-0.2.0BAML wrapper 0.2.0High6/4/2026
0.222.0Latest release: 0.222.0High4/27/2026
0.221.0Latest release: 0.221.0High4/15/2026
0.220.0Latest release: 0.220.0Medium3/11/2026
0.219.0Release 0.219.0Low2/12/2026
0.218.1Release 0.218.1Low1/27/2026
0.218.0 ## [0.218.0](https://github.com/boundaryml/baml/compare/0.217.0..0.218.0) - 2026-01-22 ### Bug Fixes - Fix Go serde decoding for dynamic types (#2978) - ([f3e48fd](https://github.com/boundaryml/baml/commit/f3e48fdc3f5f686b10ba6fa2638495ca7539fcee)) - hellovai - Fix Go codegen for pure-dynamic classes (@@dynamic with no static fields) (#2995) - ([dcc2323](https://github.com/boundaryml/baml/commit/dcc2323639ac5b5ad777dd935f2527a3b6b97b41)) - hellovai - **(cffi)** wrap result and error caLow1/22/2026
0.217.0## [0.217.0](https://github.com/boundaryml/baml/compare/0.216.0..0.217.0) - 2026-01-10 ### Features - Add native Rust SDK (#2832) - ([0b4d81a](https://github.com/boundaryml/baml/commit/0b4d81a3861efe49fc41d58c7464c6ae7388ce8c)) - hellovai - wire @description to pydantic models Field attribute (#2955) - ([ff4970a](https://github.com/boundaryml/baml/commit/ff4970ac911243ef0f8e314d1c5103391c39d278)) - Sam Lijin ### Bugs - **(zed)** Fix version (#2953) - ([a9c4d7b](https://github.com/boLow1/12/2026
0.216.0 ## [0.216.0](https://github.com/boundaryml/baml/compare/0.215.2..0.216.0) - 2025-12-31 ### Bug Fixes - **(aws-bedrock)** Pass region to DefaultCredentialsChain for IRSA support (#2856) - ([30ff957](https://github.com/boundaryml/baml/commit/30ff9577f52f69bc3861f8bdb0cf57180d94352e)) - Benjamin Poile - Fix PDF viewer CSS preload bug (#2876) - ([fb0257b](https://github.com/boundaryml/baml/commit/fb0257bdf9ec0900be9f131a83d2e05d63c33458)) - Antonio Sarosi - Fix issue where a request would Low12/31/2025
0.215.2Release 0.215.2Low12/23/2025
0.215.0 ## [0.215.0](https://github.com/boundaryml/baml/compare/0.214.0..0.215.0) - 2025-12-18 ### Bug Fixes - golang type system fixes, CFFI refactor, and testing infrastructure (#2778) - ([1afa7e8](https://github.com/boundaryml/baml/commit/1afa7e8dea1d693034a2e54f239c9378f8e091d1)) - hellovai - fix index bug (#2742) `merge_messages` previously used `foo.len() - 1`. Since `len` is a `USIZE` (unsigned int), size 0 was wrapping after decrement, cau - ([518dc61](https://github.com/boundaryml/bamlLow12/18/2025
0.214.0## [0.214.0](https://github.com/boundaryml/baml/compare/0.213.0..0.214.0) - 2025-11-24 We added TOON formatting! You can now use `{{ data|format(type="toon") }}` in your prompt when serializing arguments to use more compact format. Read more on toon here: https://github.com/toon-format/toon ### Features - **(baml)** implement static control flow visualizer (we will announce soon) (#2716) - ([4c9d507](https://github.com/boundaryml/baml/commit/4c9d50795563748952263a1ce4423f62460e2923)) - SLow11/24/2025
0.213.0Release 0.213.0Low11/6/2025
0.212.0Release 0.212.0Low10/28/2025
0.211.2Release 0.211.2Low10/12/2025
0.211.1Release 0.211.1Low10/10/2025
0.211.0 ## [0.211.0](https://github.com/boundaryml/baml/compare/0.210.0..0.211.0) - 2025-10-07 ### Bug Fixes - **(compiler)** duplicate diagnostics when typechecking (#2535) - ([5a8de50](https://github.com/boundaryml/baml/commit/5a8de50aaf42dc9cdac77e02374c8ad1396b3765)) - José Rafael Oses - Properly leave the secondary screen after non-erroring baml-cli init (#2565) - ([b911a19](https://github.com/boundaryml/baml/commit/b911a1927046b7a36d43fdaee1b25ebbfbc37f31)) - Greg Hale - Fix json parser Low10/7/2025
0.210.0Release 0.210.0Low10/1/2025
0.209.0 ## [0.209.0](https://github.com/boundaryml/baml/compare/0.208.5..0.209.0) - 2025-09-28 ### Bug Fixes - Make Studio trace uploads 6x more efficient, and fix flushing logic (#2531) - Fix an issue where we wouldn't parse a stream until the end of the stream, fix openai responses pdf input, and vertex-anthropic streaming. (#2530) - ([4bb2f33](https://github.com/boundaryml/baml/commit/4bb2f33ff908ff6a2f97fca222bc7afb5a12e8f3)) - aaronvg - **(language-server)** handle non-baml-src baml filesLow9/28/2025
0.208.5Release 0.208.5Low9/25/2025
0.208.4Release 0.208.4Low9/24/2025
0.208.3## [0.208.3](https://github.com/boundaryml/baml/compare/0.208.2..0.208.3) - 2025-09-23 ### Bug Fixes - **(lang-server)** handle non-baml-src baml files (#2486) - ([6bf3299](https://github.com/boundaryml/baml/commit/6bf32994d9411eddd2384552822a3e50a84f790f)) - Samuel Lijin - Fix wasm integ tests, fix playground not streaming (#2504) - ([f892440](https://github.com/boundaryml/baml/commit/f892440721dca21c53b57e3521176bb8dc03bb38)) - aaronvg - Bump version to 0.208.3 - ([f983b84](https://gLow9/23/2025
0.208.2 ## [0.208.2](https://github.com/boundaryml/baml/compare/0.208.0..0.208.2) - 2025-09-23 ### Bugfixes - Add mcp types (#2500) - ([0501d6d](https://github.com/boundaryml/baml/commit/0501d6db3c66cd21b02f88e2316d0bda167d56a5)) - aaronvg - Bump version to 0.208.2 - ([1624f6c](https://github.com/boundaryml/baml/commit/1624f6c60c1874ff92ae6b02366f19769c0cb9df)) - Aaron Villalpando Low9/23/2025
0.208.0 ## [0.208.0](https://github.com/boundaryml/baml/compare/0.207.1..0.208.0) - 2025-09-21 ### Features - **(jetbrains)** get closer to feature parity with vscode (#2447) - ([0efb169](https://github.com/boundaryml/baml/commit/0efb169a13b5bc14d20438e960ba3dfa530a0f29)) - Samuel Lijin - **(sdk)** errors now expose fallback history in detailed_message (#2449) - ([11a131f](https://github.com/boundaryml/baml/commit/11a131fae96ad05f49a429bc4ca845863a61f9c6)) - Samuel Lijin - Improve streaming laLow9/22/2025
0.207.1Release 0.207.1Low9/13/2025
0.207.0 ## [0.207.0](https://github.com/boundaryml/baml/compare/0.206.1..0.207.0) - 2025-09-10 ### Bug Fixes - **(python)** Update internal runtime type annotations (#2400) - ([992acaa](https://github.com/boundaryml/baml/commit/992acaa5afcdb8e52f1315f4d9c7260906b38eb0)) - Samuel Lijin - **(vscode)** make "Run test" codelenses appear in the correct place and run the correct test (#2395) - ([b9c3fea](https://github.com/boundaryml/baml/commit/b9c3fea18603f611fae3d616b6082a29004701f9)) - Samuel LijLow9/10/2025
0.206.1Release 0.206.1Low8/28/2025
0.206.0Release 0.206.0Low8/28/2025
0.205.0## [0.205.0](https://github.com/boundaryml/baml/compare/0.204.0..0.205.0) - 2025-08-14 ### Bug Fixes - **(jetbrains)** Fix installer logic (#2275) - ([a89ceb6](https://github.com/boundaryml/baml/commit/a89ceb6d1022b95e8842bcdb056d22816e3e4680)) - Samuel Lijin - handle missing `parts` field in gemini flash responses (#2272) - ([5aa9995](https://github.com/boundaryml/baml/commit/5aa9995699533d90136c508b01ac09ef9d8df4d3)) - Juan Manuel Verges - issue with some ids for embed prompt fiddle (#Low8/14/2025
0.204.0## [0.204.0](https://github.com/boundaryml/baml/compare/0.203.1..0.204.0) - 2025-08-06 ### Features - Enhance Type Builder API with listProperties() and reset() (#2177) - ([b4ddb6f](https://github.com/boundaryml/baml/commit/b4ddb6f6bae1c5bbd30ac3548103a5e997c6b695)) - Antonio Sarosi - implement ai assistant for docs (#2189) - ([d326da7](https://github.com/boundaryml/baml/commit/d326da73ebba405362016bc09fd271ef16248d50)) - Egor Lukiyanov - Implement caching for VertexAuth instances. (#2250)Low8/6/2025
0.203.1 ## [0.203.1](https://github.com/boundaryml/baml/compare/0.203.0..0.203.1) - 2025-08-01 ### Bug Fixes - fix baml-cli init, and playground state when selecting and running tests (#2242) Low8/1/2025
0.203.0 ## [0.203.0](https://github.com/boundaryml/baml/compare/0.202.1..0.203.0) - 2025-08-01 ### Bug Fixes - [Go] fix panic when downloading baml cli (#2201) - ([c8fd18b](https://github.com/boundaryml/baml/commit/c8fd18b143d19b235f44e707c2d4037e9895f4ad)) - Rahul Tiwari - [Go] Support go mod vendor (#2203) - ([c62cf63](https://github.com/boundaryml/baml/commit/c62cf63e400072292649c6ae59fb9f107ee4fc73)) - Rahul Tiwari - [Python] fix typebuilder type imports (#2209) - ([c104174](https://githubLow8/1/2025
0.202.1 ## [0.202.1](https://github.com/boundaryml/baml/compare/0.202.0..0.202.1) - 2025-07-18 ### Bug fixes - apply suggestions by cargo fix to reduce warnings (#2158) - ([4a851dc](https://github.com/boundaryml/baml/commit/4a851dca4f7fb3161602589bc6214d11fd845aee)) - Rahul Tiwari - [feat] merge union types in go whenever possible (#2160) - ([73f0c36](https://github.com/boundaryml/baml/commit/73f0c36dbe9d087acc2213374e3d14bd4ea750af)) - hellovai - Bump version to 0.202.1 - ([4ff6a02](https://gLow7/18/2025
0.202.0 ## [0.202.0](https://github.com/boundaryml/baml/compare/0.201.0..0.202.0) - 2025-07-16 ### Bug Fixes - issues with setup-dev.sh (#2133) - ([059b7c3](https://github.com/boundaryml/baml/commit/059b7c304482444c5e6b58330ed31bcf528375b3)) - Chris Watts - Fix baml-cli generate panic (#2142) - ([8884e20](https://github.com/boundaryml/baml/commit/8884e2040660782d52f2b63a0049f44bfbd05bc4)) - aaronvg - Fix generation of ignore files in openapi (#2112) - ([7eb1450](https://github.com/boundaryml/bLow7/16/2025
0.201.0Release 0.201.0Low7/3/2025
test-zedTest release please ignore.Low7/2/2025
0.200.0 ## [0.200.0](https://github.com/boundaryml/baml/compare/0.90.2..0.200.0) - 2025-07-01 ### Bug Fixes - Fix issue with baml-cli test where env vars wouldnt work (#2060) - ([344fb8a](https://github.com/boundaryml/baml/commit/344fb8a55ab46df8672904cf89bc5a814161d9c4)) - Rahul Tiwari - fix VSCode Proxy Handling due to v2 -> v3 for npm:http-proxy-middleware (#2065) - [Python] Fix issue where Baml wouldn't be pickleable - Render `none` as `null` for jinja inputs (#2037) - ([bfa98e8](https://Low7/2/2025
0.90.2Release 0.90.2Low6/21/2025
0.90.1Release 0.90.1Low6/16/2025
0.90.0 ## [0.90.0](https://github.com/boundaryml/baml/compare/0.89.0..0.90.0) - 2025-06-14 ### Bug Fixes - Fix bug where BAML_LOG wouldnt be printed in python due to a tracing bug (#2030) - ([7736f22](https://github.com/boundaryml/baml/commit/7736f22cc98916e7e24fcec7dfbaa406c5aa3a65)) - aaronvg - Fix parsing issue when there was a newline before object field (#1985) - ([ad92d3e](https://github.com/boundaryml/baml/commit/ad92d3ee847125a7a8537f3d3873e9689a0a1ce9)) - Greg Hale - implement handlingLow6/15/2025
0.89.0 ## [0.89.0](https://github.com/boundaryml/baml/compare/0.88.0..0.89.0) - 2025-05-21 ### Features - Add `hoist_classes` parameter in `ctx.output_format` (#1957) - ([42ee507](https://github.com/boundaryml/baml/commit/42ee507e21422ea6d7267172c22d534a65f700ac)) - Antonio Sarosi - [feat] Adding support for pydantic v1 (#1968) - ([3fdbfd0](https://github.com/boundaryml/baml/commit/3fdbfd05207f44a92d48d952c2ccbfeec9104850)) - hellovai - [Go] Add ClientRegistry (#1967) - ([1cb4648](https://githuLow5/21/2025
0.88.0 ## [0.88.0](https://github.com/boundaryml/baml/compare/0.87.2..0.88.0) - 2025-05-14 ### Documentation - **(tools)** add string literal examples (#1939) - ([b037124](https://github.com/boundaryml/baml/commit/b037124a64d5951b5d96ae8b237006fa3c780151)) - Elijas Dapšauskas ### Features - Support openai audio input (#1940) - ([87ed2b1](https://github.com/boundaryml/baml/commit/87ed2b1454ddf02d9e4950d0c72b12a2b04f848e)) - aaronvg - add HookData for baml react hooks, as a utility to get noLow5/14/2025
0.87.2- Fixes an issue with building the Go clientLow5/8/2025
0.87.1Release 0.87.1Low5/7/2025
0.87.0### Bugfixes - [Go] Fix optional struct fields (#1889) - ([7105b13](https://github.com/boundaryml/baml/commit/7105b13cb991e70be0cfaf338321aee6a3effbe9)) - Todd Berman - [Go] Fix go enum encoding (#1892) - ([f198ba3](https://github.com/boundaryml/baml/commit/f198ba33eea9666406fefc3da6a08c152fd63b3a)) - Todd Berman - [Go] Fix union encoding/decoding (#1898) - ([6a7dc25](https://github.com/boundaryml/baml/commit/6a7dc25e0baf61ab095b6c21a214f2f75e15b247)) - Todd Berman - [Python] Export BamlClieLow5/7/2025
0.86.1 ## [0.86.1](https://github.com/boundaryml/baml/compare/0.86.0..0.86.1) - 2025-04-30 ### Bugs - Fix arguments for functions from go (#1884) - ([b83557c](https://github.com/boundaryml/baml/commit/b83557c2c2ff279e49a7e589f5d6f06e1bd59fba)) - Todd Berman - Bump version to 0.86.1 - ([af4c366](https://github.com/boundaryml/baml/commit/af4c366c2633b6049dbdb87b8a8e0fb4ad08c286)) - Aaron VillalpandoLow4/30/2025
0.86.0 ## [0.86.0](https://github.com/boundaryml/baml/compare/0.85.0..0.86.0) - 2025-04-30 ### Bug Fixes - fix union streaming bug where unions wouldn't stream until they were done (#1858) - Fix codegen when streaming done types (#1861) - ([d6c4ff3](https://github.com/boundaryml/baml/commit/d6c4ff30ebdaa4b90440b92b2d2045eca0205775)) - Greg Hale - Go Encode/Decode fixes (#1865) - ([8ecb065](https://github.com/boundaryml/baml/commit/8ecb065d89cc10b9e306c6155146122ee3427a0f)) - Todd Berman - FiLow4/30/2025
0.85.0 ### Bug Fixes - make playground env var reveal toggle visibility on the correct row (#1816) - ([5c3794a](https://github.com/boundaryml/baml/commit/5c3794a10b2257b8f3ef9c4cc8bc49429359dbe3)) - Samuel Lijin - Fix issue where playground proxy wasn't actually used which caused CORS issues (#1841) - ([1657e35](https://github.com/boundaryml/baml/commit/1657e3529476ec1aa9ccdd2059e50795a3a5a0b9)) - aaronvg - add support for plumbing through some errors for go (#1844) - ([766ba08](https://github.cLow4/23/2025
0.84.4Release 0.84.4Low4/17/2025
0.84.3Release 0.84.3Low4/16/2025
0.84.2Release 0.84.2Low4/16/2025
0.84.1Release 0.84.1Low4/16/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

swarm_factory🚀 Build and launch a dynamic multi-agent ecosystem quickly with Swarm Factory, your go-to solution for adaptive AI development.main@2026-06-05
DreamServerLocal AI anywhere, for everyone — LLM inference, chat UI, voice, agents, workflows, RAG, and image generation. No cloud, no subscriptions.v2.5.3
tools-rsSerialize your functions with tools-rs!0.3.3
graphbitGraphBit is the world’s first enterprise-grade Agentic AI framework, built on a Rust core with a Python wrapper for unmatched speed, security, and scalability. It enables reliable multi-agent workflowGraphbit_Python_v0.6.7
AutoAgentsA multi-agent framework written in Rust that enables you to build, deploy, and coordinate multiple intelligent agentsv0.3.7

More in Frameworks

langchainThe agent engineering platform
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of ta
tqdmFast, Extensible Progress Meter
simBuild, deploy, and orchestrate AI agents. Sim is the central intelligence layer for your AI workforce.