Cette page est affichée en anglais. Une traduction française est en cours.
PromptsMay 11, 2026·2 min de lecture

BAML — Schema-First Prompting for Agents

BAML treats prompts as typed functions for reliable outputs. Install `baml-py`, define `.baml` functions, then call generated clients from Python.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 96/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Prompt
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Asset
Commande d'installation directe
npx -y tokrepo@latest install b858ed4b-d059-4634-b406-35e6ec9c5eca --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

BAML treats prompts as typed functions for reliable outputs. Install baml-py, define .baml functions, then call generated clients from Python.

  • Best for: teams iterating on prompts daily who want typesafety, streaming, and retry-friendly workflows without rewriting the whole app
  • Works with: BAML .baml files, Python via baml-py, and multi-language clients (per repo)
  • Setup time: 15 minutes

Quantitative Notes

  • PyPI package: baml-py (verified via pip index)
  • Setup time ~15 minutes
  • GitHub stars (verified): see Source & Thanks

Practical Notes

Adopt BAML when your bottleneck is iteration speed and output stability. Model your prompt as a function: inputs are typed, outputs are typed, and the prompt body is versionable. Keep a small library of BAML functions (extract, classify, route, summarize) and test them in your IDE before wiring them into agents. Over time, you get a maintainable prompt surface instead of a pile of ad-hoc strings.

Safety note: Keep function signatures small; overly generic types and huge prompts slow iteration and reduce reliability.

FAQ

Q: Do I need to write my whole app in BAML? A: No. The repo emphasizes using BAML for prompts/functions and wiring it into your existing app.

Q: What makes it different from plain prompting? A: You define a function signature with types and let the tool enforce output structure, retries, and streaming-friendly interfaces.

Q: Is it Python-only? A: No. The repo lists Python, TypeScript, Ruby, Go, and more client options via generated clients or REST patterns.


🙏

Source et remerciements

GitHub: https://github.com/BoundaryML/baml Owner avatar: https://avatars.githubusercontent.com/u/124114301?v=4 License (SPDX): Apache-2.0 GitHub stars (verified via api.github.com/repos/BoundaryML/baml): 8,206

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires