Skip to content

BAML agent notebook

A marimo notebook that runs the BAML agent. The agent is a language model that explains an EBM through the tools of the ebaml-mcp server. The notebook runs the agent from the baml command, shows the tools that the model called, and shows the message of each setup problem that a user can fix.

  • Everything up to the last button runs without an API key. The notebook fits a small EBM on made-up data, prints the signature of explain_with_mcp, and runs the offline BAML test of the agent loop on a scripted model.
  • The last button sends real requests to the LLM, one for each step of the agent. The default model needs OPENROUTER_API_KEY. Type PROVIDER/MODEL in the notebook to use another model, see Choosing the model.
  • The notebook needs the BAML toolchain (baml, version 0.25 or later) and the mcp extra: pip install "ebaml[mcp]".

The page below is the notebook with the output of its cells, exported when the docs are built. To run it:

uv run marimo edit notebooks/baml_agent.py

The guide explains the agent and its functions.

Open the notebook in its own page