https://www.boundaryml.com logo
🟡 Building an agent using BAML with predefined sy...
# questions
m
has anyone build an actual agent using BAML, where you can define the system prompt, knowledge base, tools, etc once, and the function call with the prompt itself only includes the context for that call?
a
what do you mean by including only the context? the function parameters only include a small set of daata for what you need?
b
BAML gives you primitives that would allow you to do that. But for a standard ReAct style agents (or derivatives) I found BAML to not be the best tool. Something like LangChain gives you the perfect abstraction for "Giving the agent tools and memory and instructions then running to do a task" You could make a BAML function that accepts a dynamic input where you use a
TypeBuilder
to union together the tools you want the agent to have. It's doable, but not the most ergonomic developer experience. But... I highly reccomend you read 12 factor agents repo. Once you realize that "tools" are just structured output, and in fact everything is just structured output, your whole perspective change. Where BAML shines is because of the level of granular control you get. When building something custom to your specific domains requirements in order to achieve better reliability than a standard generalized ReAct agent could, that's where BAML shines.
Googling "BAML agents" this turns up as the second result btw. The author is in this discord as well https://github.com/Elijas/baml-agents
It's a good repo to see a specific implementation of how to use
TypeBuilder
to make a Function behave more like "a configurable agent" But that's your problem right there. LangChain gives an abstraction where you pass in the config, and the framework does everything else for you (everything else...) In BAML you would have to build that config-abstraction yourself. And that's the feature!
TLDR; - LangChain is declarative - BAML is imperative - You could build LangChain with BAML, but not the other way around