Skip to main content

Sponsored by: Qubika | Agentic AI In Finance: How To Build Agents Using Databricks And LangGraph

Summary

  • Architecture overview: Qubika demonstrates how to build AI finance agents by combining LangChain, RAG, and Databricks Data and AI platform components including Unity Catalog and MLFlow.
  • Financial Analyst Agent: This video showcases a specialized agent that emulates a data analyst's expertise, delivering in-depth financial analysis in seconds instead of waiting hours for manual reports.
  • Business impact: The solution provides 24/7 access to advanced data analysis, enabling faster decision-making and eliminating manual report delays in financial operations.

Sponsored by: Qubika | Agentic AI In Finance: How To Build Agents Using Databricks And LangGraph

Watch: Sponsored by: Qubika | Agentic AI In Finance: How To Build Agents Using Databricks And LangGraph
Talk by Sebastian Diaz, SVP of Data & AI, Qubika (Sponsor Speaker)
Join us for this video on how to build AI finance agents with Databricks and LangChain. this video introduces a powerful approach to building AI agents by combining a modular framework that integrates LangChain, retrieval-augmented generation (RAG), and Databricks' unified data platform to build intelligent, adaptable finance agents. We’ll walk through the architecture and key components, including Databricks Unity Catalog, ML Flow, and Mosaic AI involved in building a system tailored for complex financial tasks like portfolio analysis, reporting automation, and real-time risk insights. We’ll also showcase a demo of one such agent in action - a Financial Analyst Agent. This agent emulates the expertise of a seasoned data analyst, delivering in-depth analysis in seconds - eliminating the need to wait hours or days for manual reports. The solution provides organizations with 24/7 access to advanced data analysis, enabling faster, smarter decision-making.
Databricks Named a Leader in the 2025 Gartner® Magic Quadrant™ for Data Science and Machine Learning Platforms: https://www.databricks.com/blog/databricks-named-leader-2025-gartner-magic-quadrant-data-science-and-machine-learning
Build and deploy quality AI agent systems: https://www.databricks.com/product/artificial-intelligence
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements

Chapters

FAQs

What is the Financial Analyst Agent?

The Financial Analyst Agent is an AI system built with Databricks Data and AI platform, LangGraph, and RAG that emulates the expertise of a seasoned data analyst, delivering complex financial analysis in seconds.

What financial tasks can this agent handle?

According to this video, the Financial Analyst Agent handles portfolio analysis, reporting automation, and real-time risk insights—tasks that would normally require hours or days of manual work.

How does it improve financial operations?

By providing 24/7 access to advanced data analysis through a conversational interface, the agent accelerates decision-making and eliminates traditional delays in generating financial reports.

What Databricks components are involved?

The solution integrates multiple Databricks Data and AI platform components including Unity Catalog for governance, MLFlow for model tracking, and Mosaic AI for orchestration.

Full transcript

0:00 Introduction and challenges

So thank you all for be here. Uh let's advance a little here. So our idea today is present for all of you how in Cuba we built a financial agent using data bricks and langraph. So a little intro about me. I'm the senior vice president of data and AI on Cuba. I have more than 15 years of experience on IT. Uh I was a programmer before and 10 years of experience on the data side. So first of all to start and I always like to start with a good baseline before going deep dive on the technical side.
So you know how different companies are advancing and they are in different maturity side on the ai. So we see that machine learning, deep learning, genai, agendic AI is right now the step that everyone is fighting, everyone is trying to solve it. So our idea today is to present you a little how we are able to solve that and especially um what is most important to us. what were the things that we discovered in this process because there are a lot of gacha moments that you are not able to see uh until you face it.

1:28 Architectural overview

So we were with a big challenge in our clients that they were looking to be faster to be able to retrieve data faster but also that made data makes sense. So let's put a scenario. Uh let's say that we have a client that has 400 trailer uh tables, two terabytes of unstructured data and each time they want to take a decision, it takes for them one day. Why? Because they need to cross reference all the information and there was a client that were moving so much data and so much money that day that they lose to actually bring the information was money.
So here when we start facing this and say okay how we are able to deal with this. So this is the solution that we were able to arrive. So what we say is so we have our structured data, semistructured data, unstructured data and the context data. So for us to be able to build a solution we would need to take in consideration all of this. Everything was needed to move to a data storage and leveraging on data bricks and another technologies we were able to build this agent on langraph to actually use it in different front ends slack teams custom front end applications and so on.
So why we did this? So mainly because this information this integration sources that you see here they were really messy. they were separating seos and also they were not thinking about it to use in AI also and I don't know if this happens in your companies but it's really common a lot of our clients they don't have business knowledge what this means is they expect AI to actually doing things about business but they don't have actual business documentation on how this works they don't have a document about uh the different key terms the uh different teams what it means the business rules and so on.

2:50 Addressing business needs

So what you find is that they want to AI uh replace or automate process but they don't give the info on how they supposed to do it. So we were we find as a first challenge to get all this information move it to a place that was useful like for example a cloud storage and after that we start guessing and getting all the information. The interesting thing here is that with data bricks we were able to leverage on the tools to actually build a spectacular lake uh house uh structure database and the business knowledge we use a vector DB uh meal boost DB to be able to build it and lastly we implement elastic search but I'm going to leave that part to the end to explain why we did it.
Lastly, the agentic side we implemented with Langraph because it gave us the opportunity to constantly interchange the things that we didn't need to change because it's not about connecting an LLM and that's it. It's about how you are able to solve this AI solution. So this was our approach on combining langraph with data bricks. So let me put you some business context. When we start this project, our client ask us, I want to be able to query all the information.
I want to have governance control to know who is access what and I want zero hallucinations. If everyone here work with Genai or you work with GPT, you know that's impossible. It's impossible to reach se hallucinations. Why? because generative AI models tends to hallucinate because it's a a probabilistic approach and not a deterministic approach and that's okay. So how was cuba able combining data bricks and langraph able to sort that?

5:30 Interpretation module

So the first thing that we say to our client is it's going to hallucinate. Obviously they all me like wait what are you telling to me? It's going to hallucinate. The thing is how you are able to deal with that hallucination. So we are able to give something that is 100% accurate. So what we did is we separate the problem in three parts. The first part was interpretation model. I'm not going to be able to answer what I supposed to answer if I don't understand what I supposed to give.
Understanding the users is key. And I don't know if you know this but the user don't know how to ask things. They don't know how to use sometimes natural language uh applications. They do some bugly they ask something really small but they referring so so much context. So what we well needed to do was understanding what this user actually asked me. The second thing was retrieving the information. And the third one was validating to reduce the hallucination and reach an almost zero hallucination uh approach.
So let's start this journey with these three models and I want to tell you some of the things that we discover jumping from these models to other. So let's start with the interpretation model. So what were the assets when we start talking about uh an agent that is able to in understand what the user wants? First of all, the actual question or the prompt that the user is giving me. The reality it was pretty bad. People didn't ask enough give enough context to actually do it.
The other input that we had was chat history. With those two things we start processing. So first of all with chat history we summarize it. So we are able to summarize a complete conversation on something that the LLM is understanding what's supposed to be what was the talking and keep maintaining a conversation. The other side was rewriting the question and how we were able to rewrite the question. So that's this is something really interesting.
First of all, we take the question, the original question, we take it to an LLM and we rewrite the question with a business knowledge. So, for example, let's say that someone is asking me for uh give me the full year revenue for 2024. So, okay, what is revenue? Where I supposed to get the revenue? Where I should supposed to get that information? So all that all that business knowledge we build it with unity catalog. We build it with um uh rules that was uh existing on the company and also with our own interpretation to give to the uh to the AI.
All that we take it, we retrieve the semantics, we identify the key terms and we create a new question that was more depth than the actually what the user asked. With all that we are sending an answer re uh sorry a question rewrited to the next output you know something that we were needed to ask when we are in this module is do we have the data is this something relevant for me or he's asking me about how to solve a Python problem so this is something that in the module we try to understand he's asking me a question about the company he's asking me about a that I supposed to see the accounting business knowledge or the HR accounting knowledge.
So when we are able to understand who is asking the question, what he actually wants and if I'm able to give that information, we go to the next module. As you see for the chat history, we use Milbus a vector DB. uh so we were able to uh get all the information all the memory into a vector DB. So it was really useful to do it. This is something that is really difficult to manage because you know when you are uh summarizing a conversation when you start summarizing maybe when you summarize you lose information.

9:42 Enhancing model intelligence

So how you handle the conversation the previous conversation is a challenge because you need to be uh performant enough so you are able to quickly give this information but not so much uh uh performant that you lose information about the talk what was important it are we changing subject are we still talking about same and when we start developing this on the start we were having an issue that maybe any one of you had that Because after the seven six question the chat start losing context.
Why? Because it was too much summarizing and the last uh the last answers were not uh they didn't have enough weight in comparison of the other part. The business context this was key. Without business we are not able to actually answer something about the business. My recommendation to all my clients you know when uh 10 15 years ago everyone's saying start storing your data start getting a data platform and storing your data.
My recommendation for uh our client is starting your business knowledge. Doesn't matter that you don't know how to apply AI. Doesn't matter that you don't have a business case. You need to start documenting your business knowledge. And right now with AI tools is easier than ever. Start uh getting your documents and save it in a place start processing like the information needs to stop living in the mind of the people and need to start being a place that AI is able to use it because it's something lamentable but people leave the company and all their knowledge is lost forever.
So we need to start saving the business knowledge. We need to have a clear list of uh key terms like maybe we are using and I always joke about this like you go to utilization. Utilization is a metric to identify uh how much your team is being utilized on available rate. But that way of calculating uh utilization that is in chat GPT maybe is different in your company. Maybe in your company you take another thing and maybe you call it in another way.
So having a key term identifier model is really important something uh and also to augment the question you need to understand what is the actual context to be give a question more useful to the output. You know something that we learned when we were working here? Our first approach was putting an LLM to do all of this. We put cheap 40 and yeah let's go do it. You are really intelligent. What was the problem? It was hallucinating.
It was too expensive and takes so much time that when you are maintaining a chat you were losing time processing on this. So we divide the problem and we think it hey how a human solve this okay so a human in her in his brain he has different part that's all a small part and they compose they do a compounding of all of it to actually reach to the answer and when we start doing that we discover that LLM were not always the solution so for example to detecting if the question is relevant to the business We use a BERT model.
A BERT model is a model really small that you need to fine-tune, but the results are amazing. It's really fast, really good. And it was we had better uh outcomes with a small bird model only to detect the intention of that o of the question than actually using an LLM for all of it. So my recommendation to detect intentions don't try to solve it with one ballot divide your problem solve it in different parts and also this is going to give you the ability to if tomorrow technology keeps growing to remove parts of it and change it update it and so on build in modules.
This is our recommendation for intention side. After that appears the retrieval model. So I have my augmented questions. I have my knowledge uh KTR key term recognition input. So I get the abstract questions. I get my uh relevant query templates. So this is an example of queries that are relevant to the business. I have my catalog that we bring it from Unity from uh Unity catalog of datab bricks. And with all of that, we create the SQL query and we use datab bricks MCP to get the information that we needed with the SQL query result.

14:44 Retrieval module

We go to the last module, the validation model. And look, this this is really interesting. The validation model their input is not only is not only the SQL query result. Why? Because what happens if you get bad on the intention classifier? You are not going to note that the actual SQL result is bad from the start. So for the val evaluation, we give the original question, the SQL query result, the business context, the SQL query originally, the Unity catalog and the SQL query output CSV.

15:26 Validation and evaluation

That one the query template. And with all of that we built our evaluation platform in MLflow that it was composed by three built-in metrics. These are metrics that you already have in MLflow or you're able to have a a package like lens to actually implement it. Custom LLM uh metrics that we develop here. You can use an LLM charge to actually evaluate aistics. These are hard rules on the business that you need to have in consideration to evaluate the answers.
And the last one and the most important, the human in the loop. Human in the loop is one of the most important evaluations on the evaluation platform. With the result of all that, we did a ranking that gives a probability of the answer that I'm going to give you, how confident it is. And maybe we have three answers, three different answers and we have a confidentiality score. If the ranking is low, then we are going to back to the previous models and iterate this.
If the ranking is high, then we take all that information and now we give it to a strong LLM, a really intelligent LLM like 4. 1 and he's going to create the last natural language answer. The amazing thing is that most of our uh other approaches when we hear it and see it from our other company, other customers, what we see is that they try to solve everything with the most potent LLM. Here we almost do everything with a 3.
5 uh GPT and we always use the higher one at the end. Conclusions to achieve high accuracy and minimize hallucinations you need to combine and create a compound model with a strong observability. If not what you are doing it's like trying to gamble the answer and when you are having people taking accountable uh uh solutions and decisions with this you cannot gamble with this. It's important to know that things are going to hallucinate and build guard rails around it.

17:56 Conclusions and best practices

Don't try to say no no it's not going to hallucinate it's going to do it. Okay, what you are going to do what that when that happens and also by building solutions in modules you are able to observe them individually and also optimize the performance. So if tomorrow's thing change, you are able to plug and play it without re-engineering the solution. And believe me, in the AI world, things are changingly weekly. So you need to be flexible enough to build this.
Lastly, it's important to have uh a strong data foundation. This client when we start working, they didn't have data bricks and having a strong data foundation was key for them. how you are able to actually build an AI solution if your data is divided in multiple places, not well structured, bad quality. So having a strong data foundation is the key for any AI projects. The last thing I want to add a lot of technical thing that I would love to share with you I'm not able to do it in this time.
So I am going to invite you to our booth in uh cuba booth that is uh near the theater 4. Uh one amazing thing is that there are so many things that we start doing with graph TVs in this solution and memory and governance and so I would love to tell all of you. So yeah thank you so much for your time. I hope that this uh helps you showing our experience and the things that we deal working with uh Langraph and data bricks and thank you so much.

Learn more about the Databricks Data and AI platform.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.