Let's integrate AI Agents in Event-Sourced Systems — Divakar Kumar, FlyersSoft
Read full transcript 18 segments
-
>> Hello everyone. >> Hello everyone. Thanks for joining. Thanks for joining. Thanks for joining. So, I think like finally we are at the So, I think like finally we are at the So, I think like finally we are at the last day of the conference. last day of the conference. last day of the conference. Personally, I had a great experience, Personally, I had a great experience, Personally, I had a great experience, learned a lot of new things. learned a lot of new things. learned a lot of new things. So, I believe by the end of the session So, I believe by the end of the session So, I believe by the end of the session you would have at least few tea you would have at least few tea you would have at least few tea takeaways that you could apply in your takeaways that you could apply in your takeaways that you could apply in your work projects. work projects. work projects. So, what is it we are going to learn? So, what is it we are going to learn? So, what is it we are going to learn? So, we are going to learn how to So, we are going to learn how to So, we are going to learn how to integrate AI agents in your existing integrate AI agents in your existing integrate AI agents in your existing system. So, this system it could be an system. So, this system it could be an system. So, this system it could be an even so system or it could be an even even so system or it could be an even even so system or it could be an even driven system or it could be any driven system or it could be any driven system or it could be any architecture that your business has architecture that your business has architecture that your business has invested over last few years, right? invested over last few years, right? invested over last few years, right? Because I always believe that these AI Because I always believe that these AI Because I always believe that these AI agents are more not agents are more not agents are more not just for the chatbots or the coding just for the chatbots or the coding just for the chatbots or the coding assistance, right? So, the real value assistance, right? So, the real value assistance, right? So, the real value that you could bring out of these AI that you could bring out of these AI that you could bring out of these AI agents is like when you start to apply agents is like when you start to apply agents is like when you start to apply these into your business workflows. these into your business workflows. these into your business workflows. And that is what we are going to learn. And that is what we are going to learn. And that is what we are going to learn. And the problem space that we are going And the problem space that we are going And the problem space that we are going to work on today is the real-time fraud to work on today is the real-time fraud to work on today is the real-time fraud detection. detection. detection. So, let me start with an example. So, So, let me start with an example. So, So, let me start with an example. So, this is my personal experience. So, a this is my personal experience. So, a this is my personal experience. So, a exactly a month ago, I purchased uh like exactly a month ago, I purchased uh like exactly a month ago, I purchased uh like I decided to purchase this laptop that I decided to purchase this laptop that I decided to purchase this laptop that I'm using for the presentation. So, it's I'm using for the presentation. So, it's I'm using for the presentation. So, it's it costed me around like $3,500.
-
it costed me around like $3,500. it costed me around like $3,500. So, I waited for a right moment. So, I So, I waited for a right moment. So, I So, I waited for a right moment. So, I was seeing like whether I have a nice was seeing like whether I have a nice was seeing like whether I have a nice offers and there was one moment. So, I offers and there was one moment. So, I offers and there was one moment. So, I decided to buy. I provided my card decided to buy. I provided my card decided to buy. I provided my card details and then I clicked on buy details and then I clicked on buy details and then I clicked on buy button. Then my transaction got button. Then my transaction got button. Then my transaction got declined. So, I thought like it was a declined. So, I thought like it was a declined. So, I thought like it was a network issue and some information has network issue and some information has network issue and some information has been misplaced. So, I tried the second been misplaced. So, I tried the second been misplaced. So, I tried the second attempt and it was failed again. attempt and it was failed again. attempt and it was failed again. Before I I the third attempt, so I got a Before I I the third attempt, so I got a Before I I the third attempt, so I got a call from the customer service asking to call from the customer service asking to call from the customer service asking to verify like if I am doing that verify like if I am doing that verify like if I am doing that particular transaction. And I was like, particular transaction. And I was like, particular transaction. And I was like, yes, I was trying to do this for the yes, I was trying to do this for the yes, I was trying to do this for the past few minutes. And I asked them like, past few minutes. And I asked them like, past few minutes. And I asked them like, why did you block my transaction? Do you why did you block my transaction? Do you why did you block my transaction? Do you know what the response was? know what the response was? know what the response was? They didn't know because I wouldn't They didn't know because I wouldn't They didn't know because I wouldn't blame blame them because they didn't blame blame them because they didn't blame blame them because they didn't know like why it was blocked. It was know like why it was blocked. It was know like why it was blocked. It was somewhere in the system, either the somewhere in the system, either the somewhere in the system, either the rule-based engine or the ML-based engine rule-based engine or the ML-based engine rule-based engine or the ML-based engine would have taken that decision. So, it would have taken that decision. So, it would have taken that decision. So, it would have looked through my transaction would have looked through my transaction would have looked through my transaction history or it would have have an average history or it would have have an average history or it would have have an average threshold beyond which like if it goes threshold beyond which like if it goes threshold beyond which like if it goes like just block the transaction, that like just block the transaction, that like just block the transaction, that would be the static rule that it would would be the static rule that it would would be the static rule that it would have had.
-
have had. have had. Because of which my transaction got Because of which my transaction got Because of which my transaction got declined. declined. declined. So, the those are the key areas, like So, the those are the key areas, like So, the those are the key areas, like those are the uncertain areas where we those are the uncertain areas where we those are the uncertain areas where we are trying to integrate the AI agents. are trying to integrate the AI agents. are trying to integrate the AI agents. Now, you might be thinking like what a Now, you might be thinking like what a Now, you might be thinking like what a great idiot, right? Because it is great idiot, right? Because it is great idiot, right? Because it is already an uncertain case like why do already an uncertain case like why do already an uncertain case like why do you want to introduce an AI agent you want to introduce an AI agent you want to introduce an AI agent because it is also a non-deterministic because it is also a non-deterministic because it is also a non-deterministic by nature, right? by nature, right? by nature, right? But the key point here that we are all But the key point here that we are all But the key point here that we are all trying to miss is that earlier in the trying to miss is that earlier in the trying to miss is that earlier in the rule-based engine or the ML-based engine rule-based engine or the ML-based engine rule-based engine or the ML-based engine like we don't have enough context. We like we don't have enough context. We like we don't have enough context. We don't have enough real-time data that don't have enough real-time data that don't have enough real-time data that gets passed on to the system. gets passed on to the system. gets passed on to the system. And those are the real data like that we And those are the real data like that we And those are the real data like that we are trying to capture from different are trying to capture from different are trying to capture from different domain context that we have in our domain context that we have in our domain context that we have in our domain. And we are going to see like how domain. And we are going to see like how domain. And we are going to see like how we could build that architecture so that we could build that architecture so that we could build that architecture so that the AI agent can make use of it and the AI agent can make use of it and the AI agent can make use of it and come up with a verdict. So, the domain that we are going to So, the domain that we are going to talk about is the real-time fraud talk about is the real-time fraud talk about is the real-time fraud detection as I mentioned before. So, we detection as I mentioned before. So, we detection as I mentioned before. So, we had this rule-based engine like uh 5 had this rule-based engine like uh 5 had this rule-based engine like uh 5 years before. And this rule-based engine years before. And this rule-based engine years before. And this rule-based engine was perfectly fine like it was working was perfectly fine like it was working was perfectly fine like it was working perfectly fine for few of the cases. And perfectly fine for few of the cases. And perfectly fine for few of the cases. And but but the problem with this rule-based but but the problem with this rule-based but but the problem with this rule-based engine is like the maintainability engine is like the maintainability engine is like the maintainability because the fraudsters are because the fraudsters are because the fraudsters are trying to get intruded into a system trying to get intruded into a system trying to get intruded into a system like by a lot of different ways and you like by a lot of different ways and you like by a lot of different ways and you just need to keep on updating these just need to keep on updating these just need to keep on updating these static rules day by day and it it it's static rules day by day and it it it's static rules day by day and it it it's going to be really difficult for you to going to be really difficult for you to going to be really difficult for you to manage. And that's when like we started manage. And that's when like we started manage. And that's when like we started to to to tie up with a third-party provider like
-
tie up with a third-party provider like tie up with a third-party provider like who helped us to who helped us to who helped us to develop this ML model. So we we have develop this ML model. So we we have develop this ML model. So we we have this ML base approach like where this ML base approach like where this ML base approach like where we shared with them transaction history we shared with them transaction history we shared with them transaction history or different features with them like or different features with them like or different features with them like based on that they trained the ML model based on that they trained the ML model based on that they trained the ML model and we were able to get a risk code and we were able to get a risk code and we were able to get a risk code based on that which with which like we based on that which with which like we based on that which with which like we were were were able to block or approve the able to block or approve the able to block or approve the transaction. transaction. transaction. But the problem with either of these But the problem with either of these But the problem with either of these approaches like either like we we were approaches like either like we we were approaches like either like we we were able to handle most of the transaction able to handle most of the transaction able to handle most of the transaction because it would fall below a certain because it would fall below a certain because it would fall below a certain threshold then we would approve the threshold then we would approve the threshold then we would approve the transaction and if it goes beyond a transaction and if it goes beyond a transaction and if it goes beyond a certain certain certain threshold we would be blocking those threshold we would be blocking those threshold we would be blocking those transaction. But majority of the transaction. But majority of the transaction. But majority of the transaction like few of the transaction transaction like few of the transaction transaction like few of the transaction like goes under the gray zone area like goes under the gray zone area like goes under the gray zone area and this is the area where it is really and this is the area where it is really and this is the area where it is really uncertain for those systems to really uncertain for those systems to really uncertain for those systems to really come to a conclusion whether it is an come to a conclusion whether it is an come to a conclusion whether it is an fraudulent transaction or a legitimate fraudulent transaction or a legitimate fraudulent transaction or a legitimate transaction. transaction. transaction. So what we are trying to do is like we So what we are trying to do is like we So what we are trying to do is like we we had we had we had built a system where we had both these built a system where we had both these built a system where we had both these tier one system which has this rule tier one system which has this rule tier one system which has this rule based or the traditional ML model and based or the traditional ML model and based or the traditional ML model and then we also had a tier two system which then we also had a tier two system which then we also had a tier two system which is agentic AI approach like most of the is agentic AI approach like most of the is agentic AI approach like most of the cases would be handled cases would be handled cases would be handled really well by these existing system we really well by these existing system we really well by these existing system we already had because our thought process already had because our thought process already had because our thought process is not to exclude the systems that we is not to exclude the systems that we is not to exclude the systems that we already had. We we are just trying to already had. We we are just trying to already had. We we are just trying to handle
-
handle handle few of the areas like that is the gray few of the areas like that is the gray few of the areas like that is the gray zone areas with the help of agentic AI zone areas with the help of agentic AI zone areas with the help of agentic AI processing. processing. processing. So this is the approach like that we So this is the approach like that we So this is the approach like that we decided okay let's move on with this decided okay let's move on with this decided okay let's move on with this approach." But then our architecture, approach." But then our architecture, approach." But then our architecture, our our our domain is really complicated. So, this domain is really complicated. So, this domain is really complicated. So, this is our different bounded contexts that is our different bounded contexts that is our different bounded contexts that we have internally in our domain. So, we have internally in our domain. So, we have internally in our domain. So, the transaction context holds all the the transaction context holds all the the transaction context holds all the details about your transactions. Like, details about your transactions. Like, details about your transactions. Like, it knows about the merchants. it knows about the merchants. it knows about the merchants. It knows about the amounts that that you It knows about the amounts that that you It knows about the amounts that that you transact. And everything related to a transact. And everything related to a transact. And everything related to a transaction would be residing on this transaction would be residing on this transaction would be residing on this particular context. And it doesn't have particular context. And it doesn't have particular context. And it doesn't have any information about the customer it is any information about the customer it is any information about the customer it is handling, or it doesn't have any handling, or it doesn't have any handling, or it doesn't have any information about the payments or the information about the payments or the information about the payments or the device details. device details. device details. That is what the That is what the That is what the bounded context means, right? Because if bounded context means, right? Because if bounded context means, right? Because if you are from the DDD background or you are from the DDD background or you are from the DDD background or software engineering, like you would software engineering, like you would software engineering, like you would know that these are different bounded know that these are different bounded know that these are different bounded contexts like with like you wouldn't contexts like with like you wouldn't contexts like with like you wouldn't share the data among themselves. Like, share the data among themselves. Like, share the data among themselves. Like, you need to do an asynchronous way of you need to do an asynchronous way of you need to do an asynchronous way of communication. And communication. And communication. And like like like all sort of things like that you would all sort of things like that you would all sort of things like that you would do in a microservice communication would do in a microservice communication would do in a microservice communication would necessarily be done here as well.
-
necessarily be done here as well. necessarily be done here as well. So, then we do have accounts context. So, then we do have accounts context. So, then we do have accounts context. All the details about the accounts like All the details about the accounts like All the details about the accounts like the KYC complaining, whether the user is the KYC complaining, whether the user is the KYC complaining, whether the user is KYC compliant, or anything about the KYC compliant, or anything about the KYC compliant, or anything about the customer. Like, if you want to know customer. Like, if you want to know customer. Like, if you want to know about the customer, this would be the about the customer, this would be the about the customer, this would be the right context that we need to reach out right context that we need to reach out right context that we need to reach out to. And there is a device context. Like, to. And there is a device context. Like, to. And there is a device context. Like, we had stored all the device we had stored all the device we had stored all the device fingerprints, browser fingerprints, the fingerprints, browser fingerprints, the fingerprints, browser fingerprints, the OS that they are using OS that they are using OS that they are using over these device contexts. Like, that over these device contexts. Like, that over these device contexts. Like, that would be really helpful like for would be really helpful like for would be really helpful like for detecting these kinds of real-time detecting these kinds of real-time detecting these kinds of real-time frauds. frauds. frauds. And finally, like we had payment And finally, like we had payment And finally, like we had payment context. So, any sort of chargebacks or context. So, any sort of chargebacks or context. So, any sort of chargebacks or anything related to the payments will be anything related to the payments will be anything related to the payments will be residing on this particular context. residing on this particular context. residing on this particular context. So, now the problem that we have with So, now the problem that we have with So, now the problem that we have with this kind of an architecture is like we this kind of an architecture is like we this kind of an architecture is like we we really we really don't have a way or we really we really don't have a way or we really we really don't have a way or means to share these means to share these means to share these data across different data across different data across different bounded contexts, right? So, that's bounded contexts, right? So, that's bounded contexts, right? So, that's where like we started to introduce an where like we started to introduce an where like we started to introduce an orchestrator layer. So, earlier like we orchestrator layer. So, earlier like we orchestrator layer. So, earlier like we had this orchestrator layer, but now we had this orchestrator layer, but now we had this orchestrator layer, but now we also have an agentic AI inside this also have an agentic AI inside this also have an agentic AI inside this orchestrator. So, what this orchestrator orchestrator. So, what this orchestrator orchestrator. So, what this orchestrator does is like similar to does is like similar to does is like similar to a saga orchestration. So, all the a saga orchestration. So, all the a saga orchestration. So, all the communication would go through this communication would go through this communication would go through this layer and then it would be layer and then it would be layer and then it would be communicated to other services like who communicated to other services like who communicated to other services like who are interested in those events. And that are interested in those events. And that are interested in those events. And that is how like we define this orchestration is how like we define this orchestration is how like we define this orchestration layer.
-
layer. layer. And And And we also have an asynchronous way of we also have an asynchronous way of we also have an asynchronous way of communicating with within other communicating with within other communicating with within other different contexts like through a different contexts like through a different contexts like through a message broker. message broker. message broker. If I zoom in a little bit on the If I zoom in a little bit on the If I zoom in a little bit on the transaction context, you could see what transaction context, you could see what transaction context, you could see what what are the details that these what are the details that these what are the details that these transactions are holding. So, transactions are holding. So, transactions are holding. So, essentially like what happens is like essentially like what happens is like essentially like what happens is like when you have when you have when you have particular domain, you will be having particular domain, you will be having particular domain, you will be having different events that are emitted from different events that are emitted from different events that are emitted from that system. So, those are really called that system. So, those are really called that system. So, those are really called as domain events. And within our as domain events. And within our as domain events. And within our transaction context like we do have transaction context like we do have transaction context like we do have transaction created domain event, which transaction created domain event, which transaction created domain event, which is the start of entire transaction. And is the start of entire transaction. And is the start of entire transaction. And we do have lot of integration events. we do have lot of integration events. we do have lot of integration events. So, these are the events that comes from So, these are the events that comes from So, these are the events that comes from other contexts like payment contexts, other contexts like payment contexts, other contexts like payment contexts, device contexts, or account contexts. device contexts, or account contexts. device contexts, or account contexts. So, events like transaction rejected, So, events like transaction rejected, So, events like transaction rejected, payment approved, payment rejected would payment approved, payment rejected would payment approved, payment rejected would come from other systems to our come from other systems to our come from other systems to our transaction contexts. transaction contexts. transaction contexts. And these entire informations are stored And these entire informations are stored And these entire informations are stored in our NoSQL database. in our NoSQL database. in our NoSQL database. We are currently using Cosmos DB as our We are currently using Cosmos DB as our We are currently using Cosmos DB as our event store.
-
event store. event store. And we are following event sourcing as And we are following event sourcing as And we are following event sourcing as our methodology to store the events. So, our methodology to store the events. So, our methodology to store the events. So, what happens is like whenever user what happens is like whenever user what happens is like whenever user initiate a command, so that goes into initiate a command, so that goes into initiate a command, so that goes into our event store as an event as a our event store as an event as a our event store as an event as a business fact. So, we are not mutating business fact. So, we are not mutating business fact. So, we are not mutating the state, but instead like we are the state, but instead like we are the state, but instead like we are appending all the events as when it appending all the events as when it appending all the events as when it arrives. And what it really helped us to arrives. And what it really helped us to arrives. And what it really helped us to do is like once it arrives into the do is like once it arrives into the do is like once it arrives into the event store, event store, event store, so we have a kind of a mechanism called so we have a kind of a mechanism called so we have a kind of a mechanism called CDC or in no sequel word this is called CDC or in no sequel word this is called CDC or in no sequel word this is called as a change feed with which like as a change feed with which like as a change feed with which like whenever there is a change or update whenever there is a change or update whenever there is a change or update happens over a table, so you will be happens over a table, so you will be happens over a table, so you will be getting notified and those changes could getting notified and those changes could getting notified and those changes could be propagated into different read be propagated into different read be propagated into different read models. models. models. So, because in in in a real scenario So, because in in in a real scenario So, because in in in a real scenario like you won't be able to rely entirely like you won't be able to rely entirely like you won't be able to rely entirely upon the event store for the query upon the event store for the query upon the event store for the query operation for the read operation. What operation for the read operation. What operation for the read operation. What you would do is like internal like you you would do is like internal like you you would do is like internal like you will be having different read models will be having different read models will be having different read models which are optimized for the read which are optimized for the read which are optimized for the read operations. So, what we really had is operations. So, what we really had is operations. So, what we really had is like we had multiple read models. So, like we had multiple read models. So, like we had multiple read models. So, one for timelines, one for customer one for timelines, one for customer one for timelines, one for customer information, and one for the fraud in information, and one for the fraud in information, and one for the fraud in the indicators, the risk view.
-
the indicators, the risk view. the indicators, the risk view. So, these are the different read model So, these are the different read model So, these are the different read model later layers that we had within our later layers that we had within our later layers that we had within our transaction context. transaction context. transaction context. And essentially like you can't And essentially like you can't And essentially like you can't you can't you can't say other teams to you can't you can't say other teams to you can't you can't say other teams to follow the same patterns because even follow the same patterns because even follow the same patterns because even sourcing is not the one that other teams sourcing is not the one that other teams sourcing is not the one that other teams are also following. So, what we did is are also following. So, what we did is are also following. So, what we did is like we also had this asynchronous way like we also had this asynchronous way like we also had this asynchronous way of communication by of communication by of communication by emitting those events into the message emitting those events into the message emitting those events into the message broker and those broker and those broker and those those events in turn will be processed those events in turn will be processed those events in turn will be processed by a worker process and then it will be by a worker process and then it will be by a worker process and then it will be reaching out to our projection layer. reaching out to our projection layer. reaching out to our projection layer. So, the idea is like we need to gather So, the idea is like we need to gather So, the idea is like we need to gather all the data from all these different all the data from all these different all the data from all these different contexts and to have or build a semantic contexts and to have or build a semantic contexts and to have or build a semantic layer or you could call it as a layer or you could call it as a layer or you could call it as a materialized view which you could materialized view which you could materialized view which you could further use within your agent further use within your agent further use within your agent >> careful. >> So, this is how the high-level flow >> So, this is how the high-level flow looks like like we have all these looks like like we have all these looks like like we have all these different contexts and you could either different contexts and you could either different contexts and you could either use a CDC mechanism or a message broker use a CDC mechanism or a message broker use a CDC mechanism or a message broker to propagate those events into your to propagate those events into your to propagate those events into your projection layer. And essentially like projection layer. And essentially like projection layer. And essentially like you will be having this intermediate you will be having this intermediate you will be having this intermediate layer like which is a worker process.
-
layer like which is a worker process. layer like which is a worker process. You need to massage your message events You need to massage your message events You need to massage your message events and then process it and then store them and then process it and then store them and then process it and then store them in the materials view. So, this this is in the materials view. So, this this is in the materials view. So, this this is the entire high-level picture of how you the entire high-level picture of how you the entire high-level picture of how you could gather those data and form a could gather those data and form a could gather those data and form a materials view. materials view. materials view. Now, coming to the agents. So, Now, coming to the agents. So, Now, coming to the agents. So, so, we all know like agents are so, we all know like agents are so, we all know like agents are comprised of these three main comprised of these three main comprised of these three main components, the language models, the components, the language models, the components, the language models, the tools, and the memories, right? So, this tools, and the memories, right? So, this tools, and the memories, right? So, this language model it it is not necessary to language model it it is not necessary to language model it it is not necessary to be a large language model. It could be a be a large language model. It could be a be a large language model. It could be a SLM. It could be an open-source model. SLM. It could be an open-source model. SLM. It could be an open-source model. And the tools are by which like you And the tools are by which like you And the tools are by which like you could interact with the external APIs or could interact with the external APIs or could interact with the external APIs or the meta the meta the meta methods that you define in inside your methods that you define in inside your methods that you define in inside your application layer. And you also need to application layer. And you also need to application layer. And you also need to have a memory layer. For this particular have a memory layer. For this particular have a memory layer. For this particular use case like we are using an inch um use case like we are using an inch um use case like we are using an inch um short memory because uh you you can't short memory because uh you you can't short memory because uh you you can't really really really um rely on the long-term memory because um rely on the long-term memory because um rely on the long-term memory because you need to um adhere to the uh SLA that you need to um adhere to the uh SLA that you need to um adhere to the uh SLA that you uh provided to the customers because you uh provided to the customers because you uh provided to the customers because for for the transaction uh to be for for the transaction uh to be for for the transaction uh to be processed like it should be sub 500 processed like it should be sub 500 processed like it should be sub 500 milliseconds. And you we are currently milliseconds. And you we are currently milliseconds. And you we are currently using in-memory for this. And using in-memory for this. And using in-memory for this. And essentially like what happens is like essentially like what happens is like essentially like what happens is like whenever there is an query comes into whenever there is an query comes into whenever there is an query comes into our language model, so it has this our language model, so it has this our language model, so it has this reasoning capability, the thinking reasoning capability, the thinking reasoning capability, the thinking capability with which like it tries to capability with which like it tries to capability with which like it tries to decompose the task into multiple chunks.
-
decompose the task into multiple chunks. decompose the task into multiple chunks. And each of these tasks in turn will uh And each of these tasks in turn will uh And each of these tasks in turn will uh go into the language model, do certain go into the language model, do certain go into the language model, do certain certain processing with the help of the certain processing with the help of the certain processing with the help of the tools, and it will see like if the end tools, and it will see like if the end tools, and it will see like if the end goal is reached. And if it is not goal is reached. And if it is not goal is reached. And if it is not reached like it will try to go on in reached like it will try to go on in reached like it will try to go on in this loop. So, this is what essentially this loop. So, this is what essentially this loop. So, this is what essentially happens inside the uh agentic framework. happens inside the uh agentic framework. happens inside the uh agentic framework. But you should really know like when to But you should really know like when to But you should really know like when to stop this loop uh because stop this loop uh because stop this loop uh because uh uh uh this this depends uh this this is this this this depends uh this this is this this this depends uh this this is this might be varying. This might be might be varying. This might be might be varying. This might be differing for different use cases. For differing for different use cases. For differing for different use cases. For for our use case like we do have a for our use case like we do have a for our use case like we do have a metrics with beyond which like if we go metrics with beyond which like if we go metrics with beyond which like if we go like we we could break out of this loop. like we we could break out of this loop. like we we could break out of this loop. And this could be varying for different And this could be varying for different And this could be varying for different use cases. So, you should be really use cases. So, you should be really use cases. So, you should be really careful on avoiding this infinite loop. careful on avoiding this infinite loop. careful on avoiding this infinite loop. And now coming back to our uh existing And now coming back to our uh existing And now coming back to our uh existing architecture. So, what we did is like architecture. So, what we did is like architecture. So, what we did is like earlier like we learned about the earlier like we learned about the earlier like we learned about the transaction aggregate. So, now we are transaction aggregate. So, now we are transaction aggregate. So, now we are emitting some events that gets emitting some events that gets emitting some events that gets translated into an integration event, translated into an integration event, translated into an integration event, which gets passed on to the message which gets passed on to the message which gets passed on to the message broker, and then it it is handled under broker, and then it it is handled under broker, and then it it is handled under the orchestration layer.
-
the orchestration layer. the orchestration layer. So, under this orchestration layer like So, under this orchestration layer like So, under this orchestration layer like we have different sub orchestrator. So, we have different sub orchestrator. So, we have different sub orchestrator. So, we segregated the tier one. Earlier like we segregated the tier one. Earlier like we segregated the tier one. Earlier like we just had the tier one. Now, we had we just had the tier one. Now, we had we just had the tier one. Now, we had the tier one layer, which is handling the tier one layer, which is handling the tier one layer, which is handling the the the um rule-based engine or the ML-based um rule-based engine or the ML-based um rule-based engine or the ML-based engine. And we also had now the tier two engine. And we also had now the tier two engine. And we also had now the tier two layer, which is going to be agent AK layer, which is going to be agent AK layer, which is going to be agent AK processing. So, for this agent AK processing. So, for this agent AK processing. So, for this agent AK processing like we used fan out pattern. processing like we used fan out pattern. processing like we used fan out pattern. So, we kind of use multiple agents So, we kind of use multiple agents So, we kind of use multiple agents within this layer, and we are trying to within this layer, and we are trying to within this layer, and we are trying to use a fan out pattern like um once the use a fan out pattern like um once the use a fan out pattern like um once the uh event has been reached out to the uh uh event has been reached out to the uh uh event has been reached out to the uh tier two layer, we will be fanning out tier two layer, we will be fanning out tier two layer, we will be fanning out this this this um event to two different agents. One is um event to two different agents. One is um event to two different agents. One is the risk analyzer agent, the other one the risk analyzer agent, the other one the risk analyzer agent, the other one is the behavior analyzer agent. And once is the behavior analyzer agent. And once is the behavior analyzer agent. And once these agents like come to a conclusion these agents like come to a conclusion these agents like come to a conclusion based on the different tools that it based on the different tools that it based on the different tools that it has, it will finally send the response has, it will finally send the response has, it will finally send the response to the verdict. to the verdict. to the verdict. And this verdict could be a metric. It And this verdict could be a metric. It And this verdict could be a metric. It could be just an if condition inside could be just an if condition inside could be just an if condition inside your application layer, or it could be your application layer, or it could be your application layer, or it could be an another region. Because what we seen an another region. Because what we seen an another region. Because what we seen is like is like is like if we are using just the metrics, it is if we are using just the metrics, it is if we are using just the metrics, it is again going back to the same criteria again going back to the same criteria again going back to the same criteria like where we had this rule-based um like where we had this rule-based um like where we had this rule-based um mechanism.
-
mechanism. mechanism. Uh so, there are many false positive Uh so, there are many false positive Uh so, there are many false positive cases that we are that we faced. So, so cases that we are that we faced. So, so cases that we are that we faced. So, so we we in turn like we are trying to use we we in turn like we are trying to use we we in turn like we are trying to use a third agent in this verdict layer, a third agent in this verdict layer, a third agent in this verdict layer, which analyzes both the agents' which analyzes both the agents' which analyzes both the agents' responses and come to a conclusion, responses and come to a conclusion, responses and come to a conclusion, which is then going to be emitted as an which is then going to be emitted as an which is then going to be emitted as an event back to this message broker. So, event back to this message broker. So, event back to this message broker. So, this is how our saga flow continues and this is how our saga flow continues and this is how our saga flow continues and it gets into the payment context and it gets into the payment context and it gets into the payment context and then the payments are approved and then then the payments are approved and then then the payments are approved and then it is going back to the transaction it is going back to the transaction it is going back to the transaction context. This entire loop is being done context. This entire loop is being done context. This entire loop is being done within our orchestration layer. And this This is what I was talking And this This is what I was talking about two agents that we had in this about two agents that we had in this about two agents that we had in this tier two. So, one is the risk analysis tier two. So, one is the risk analysis tier two. So, one is the risk analysis agent, like what are the tools that we agent, like what are the tools that we agent, like what are the tools that we have in this an agent is that like we do have in this an agent is that like we do have in this an agent is that like we do have this kind of uh storing the fraud have this kind of uh storing the fraud have this kind of uh storing the fraud histories inside the semantic layer that histories inside the semantic layer that histories inside the semantic layer that we earlier see and we are currently we earlier see and we are currently we earlier see and we are currently having a tool for that. Like um it will having a tool for that. Like um it will having a tool for that. Like um it will just get those details from these just get those details from these just get those details from these projections layer. And we also have a projections layer. And we also have a projections layer. And we also have a device trust layer, like all the device device trust layer, like all the device device trust layer, like all the device information will get stored into this information will get stored into this information will get stored into this semantic layer and it will just get semantic layer and it will just get semantic layer and it will just get those chunks alone.
-
those chunks alone. those chunks alone. And we also had um a business rules And we also had um a business rules And we also had um a business rules trying to migrate some of the rules that trying to migrate some of the rules that trying to migrate some of the rules that we had in the rule base engine over this we had in the rule base engine over this we had in the rule base engine over this tools and these are really specific to tools and these are really specific to tools and these are really specific to our business use case, so we are trying our business use case, so we are trying our business use case, so we are trying to move those into this tools. And we to move those into this tools. And we to move those into this tools. And we also have a be- behavior analysis tool. also have a be- behavior analysis tool. also have a be- behavior analysis tool. So So, there like we are analyzing the So So, there like we are analyzing the So So, there like we are analyzing the transaction patterns with two different transaction patterns with two different transaction patterns with two different plugins that we have. plugins that we have. plugins that we have. So, based on these two different agents, So, based on these two different agents, So, based on these two different agents, the responses like we get to a final the responses like we get to a final the responses like we get to a final consensus and then that will be consensus and then that will be consensus and then that will be published as an event, which will be published as an event, which will be published as an event, which will be captured by the message broker. And this captured by the message broker. And this captured by the message broker. And this will be listened or uh this will be will be listened or uh this will be will be listened or uh this will be subscribed by all the different subscribed by all the different subscribed by all the different contexts, which are interested in those contexts, which are interested in those contexts, which are interested in those events. events. events. Now, as as as we seen earlier, like how Now, as as as we seen earlier, like how Now, as as as we seen earlier, like how does these um agents gather contexts? does these um agents gather contexts? does these um agents gather contexts? So, So, So, from the projection layer. So, these from the projection layer. So, these from the projection layer. So, these orchestration is going to consume these orchestration is going to consume these orchestration is going to consume these uh uh uh datas from the projection layers and how datas from the projection layers and how datas from the projection layers and how it is going to do is by the help of it is going to do is by the help of it is going to do is by the help of tools that it already has.
-
tools that it already has. tools that it already has. So, the transaction context, it is going So, the transaction context, it is going So, the transaction context, it is going to denormalize some of the counts, to denormalize some of the counts, to denormalize some of the counts, averages, average amounts that we had, averages, average amounts that we had, averages, average amounts that we had, the recent transactions, all gets into the recent transactions, all gets into the recent transactions, all gets into this this this semantic layer, and the device context semantic layer, and the device context semantic layer, and the device context is going to send all the details about is going to send all the details about is going to send all the details about the device trust score, location the device trust score, location the device trust score, location histories, and all other histories, and all other histories, and all other related information related information related information about the locations, IP addresses to about the locations, IP addresses to about the locations, IP addresses to this semantic layer. And the account this semantic layer. And the account this semantic layer. And the account context is going to send the statuses of context is going to send the statuses of context is going to send the statuses of the accounts, the KYC status, account the accounts, the KYC status, account the accounts, the KYC status, account age, age, age, whether the customer has been with us whether the customer has been with us whether the customer has been with us for the past few years. for the past few years. for the past few years. So, based on that, like it will try to So, based on that, like it will try to So, based on that, like it will try to validate the um validate the um validate the um uh the the customer based on those uh the the customer based on those uh the the customer based on those informations. And there is also the informations. And there is also the informations. And there is also the payment context. From this, like we get payment context. From this, like we get payment context. From this, like we get to know about the recent payments that to know about the recent payments that to know about the recent payments that we we we gathered over these contexts into the gathered over these contexts into the gathered over these contexts into the semantic layer. semantic layer. semantic layer. And and as I as I said earlier, so these And and as I as I said earlier, so these And and as I as I said earlier, so these tools get uh access to these projection tools get uh access to these projection tools get uh access to these projection layer, and which in turn will be used by layer, and which in turn will be used by layer, and which in turn will be used by these agents to come to a conclusion.
-
these agents to come to a conclusion. these agents to come to a conclusion. And this is the high-level um And this is the high-level um And this is the high-level um architecture that we had. So, it could architecture that we had. So, it could architecture that we had. So, it could be any even source that you could use. be any even source that you could use. be any even source that you could use. And basically, like you could have a And basically, like you could have a And basically, like you could have a relational database or no SQL database. relational database or no SQL database. relational database or no SQL database. In turn, like you you need to just In turn, like you you need to just In turn, like you you need to just create the semantic layer for you to create the semantic layer for you to create the semantic layer for you to provide enough context to these AI provide enough context to these AI provide enough context to these AI agents. And we do have this agentic agents. And we do have this agentic agents. And we do have this agentic layer in the orchestration. So, we have layer in the orchestration. So, we have layer in the orchestration. So, we have this verdict tool, and then the this verdict tool, and then the this verdict tool, and then the short-term memory, and based on that, short-term memory, and based on that, short-term memory, and based on that, like whatever the result that we get like whatever the result that we get like whatever the result that we get gets on passed to the saga orchestration gets on passed to the saga orchestration gets on passed to the saga orchestration layer. layer. layer. So, we I I I have prepared a POC. So, So, we I I I have prepared a POC. So, So, we I I I have prepared a POC. So, based on the synthetic data, so I will based on the synthetic data, so I will based on the synthetic data, so I will just show you like how this works just show you like how this works just show you like how this works in in in in in in in in in Let me run this one. So, these are the different contexts So, these are the different contexts that we have seen earlier. So, the that we have seen earlier. So, the that we have seen earlier. So, the transaction context, accounts, and transaction context, accounts, and transaction context, accounts, and device context. device context. device context. So, from these, like we will get into So, from these, like we will get into So, from these, like we will get into the projections layer, and we will be the projections layer, and we will be the projections layer, and we will be having a CDC mechanism with which, like having a CDC mechanism with which, like having a CDC mechanism with which, like you will be able to you will be able to you will be able to progress propagate those events back to progress propagate those events back to progress propagate those events back to your semantic layer, which will your semantic layer, which will your semantic layer, which will get in turn used by these AI agents.
-
So, here you could see So, here you could see So, there are multiple simulation events So, there are multiple simulation events So, there are multiple simulation events that we are that we are that we are simulating into the our systems. simulating into the our systems. simulating into the our systems. And you could see bunch of events are And you could see bunch of events are And you could see bunch of events are currently populating. So, these currently populating. So, these currently populating. So, these um events are propagating through um events are propagating through um events are propagating through different layers, the transaction layer, different layers, the transaction layer, different layers, the transaction layer, accounts, and then payments context. accounts, and then payments context. accounts, and then payments context. And finally, like we also have this And finally, like we also have this And finally, like we also have this uh AI agent layer, like which which uh AI agent layer, like which which uh AI agent layer, like which which is going to try with the tier one is going to try with the tier one is going to try with the tier one processing, uh the ML processing. I think it is just a database which is I think it is just a database which is in the serverless mode. Um I think it is in the serverless mode. Um I think it is in the serverless mode. Um I think it is coming up slowly. So, but but yeah, the coming up slowly. So, but but yeah, the coming up slowly. So, but but yeah, the idea is like you will be able to see idea is like you will be able to see idea is like you will be able to see like two different agents coming up with like two different agents coming up with like two different agents coming up with two different uh conclusions, and you two different uh conclusions, and you two different uh conclusions, and you will be having a third agent which will will be having a third agent which will will be having a third agent which will take the final decision.
-
take the final decision. take the final decision. Uh that will be in turn emitted as an Uh that will be in turn emitted as an Uh that will be in turn emitted as an event back to your message broker. And event back to your message broker. And event back to your message broker. And this saga flow will be continuing as for this saga flow will be continuing as for this saga flow will be continuing as for uh like how you designed your business uh like how you designed your business uh like how you designed your business architecture. architecture. architecture. And going back to my presentation. Yeah, that's it. If you have any Yeah, that's it. If you have any questions, like you can reach out to me questions, like you can reach out to me questions, like you can reach out to me offline or you can reach out to me on offline or you can reach out to me on offline or you can reach out to me on LinkedIn. Thank you. LinkedIn. Thank you. LinkedIn. Thank you. >> [applause]
Summary
This session focuses on integrating AI agents into existing systems, particularly for real-time fraud detection, using a personal anecdote about a declined laptop purchase as an example. The key takeaway is that AI agents can enhance business workflows beyond simple chatbots, improving the effectiveness of systems like rule-based or ML-based fraud detection engines. The practical conclusion is to leverage AI agents to proactively address and optimize these critical business processes.