https://www.boundaryml.com logo
🟡 Seeking advice on using BAML for a SQL agent da...
# questions
j
hey guys 😄 i'm a bit of a noob in baml so bare with me pls 🙂 atm i'm not sure baml can solve some of my problems without trading off a shit ton of time. Here's what i'm building: Right now, i want to build an sql agent that has a dashboard for visualizations (graphs/plots), i want it to act in a unified way with the dashboard, like ask question-> create sql -> show results -> suggest plot-> add plot. This is one use case but i want it to be super open and not a strict workflow. i want to take all kinds of questions in the scope of the product and act accordingly with my tools. i already built my basic tools (execute sql, validate sql, retrieval question-sql pairs, get_table_info, get_schema_info ... it's missing the dashboard tools ) and have the dbs (postgres+chroma) with data . i built a 1st poc with agno, but it's a bit inconsistent and i see future painpoints to integrate with the dashboard. do u think baml is a good choice to tackle this problem? and if yes, how should i think about it more aless? i've been researching and trying to come up with an architecture but i still too confused to have a clear vision. would immensely appreciate the help 🙏
v
hey @josefonte here's a few references that should help you understand how to do this in BAML: https://boundaryml.com/podcast/2025-04-15-code-generation-small-models This episode explicitly talks about how to generate code https://boundaryml.com/podcast/2025-04-07-reasoning-models-vs-prompts This episode has acutal code snippet for a backend + frontend that generates graphql code to answer semantic questions. Code here: (https://github.com/ai-that-works/ai-that-works/tree/main/2025-04-07-reasoning-models-vs-prompts) https://boundaryml.com/podcast/2025-04-22-twelve-factor-agents This is the most fundamental episode that helps explain how to think about tool calling. I recommend watching this one first!

https://www.youtube.com/watch?v=j5TwkxB_2A4&list=PLbzoR-pLrL6oAsF17rJsdZ0NiKnb2-xD1&index=41▾

This is a more indepth walkthough of how to think about agents + tool calling in the BAML way!
and tldr is your BAML function for your agent will end up looking something like:
Copy code
typescript
function ChatAgent(state: Message[]) -> GenerateSql | ShowResults | SuggestPlot | AddPlot | Reply { 
...
}
let me know if this stuff helps! I recommend watching the links from bottom up in terms of relevance! (the last two are the most most important)
j
awesome 😄 thank you so much 🙏 i will def look more into this
love the ai that works videos btw xD really changed the way i think about agents and context
v
❤️
glad that they are useful!
if you ever have topic suggestions, let us know!
j
oki, thx :))