Chaining Multiple Agents in a Chat Flow
Summary
In this video, I demonstrate how to chain multiple agents together in a single chat flow to improve response accuracy and specificity. I showcase a two-step chat flow with two different agents: one for background research and the other for gathering information and analysis. The first agent uses a salary search tool to identify connections between a given entity and China, while the second agent determines if the entity has any supply chain connections to Xinjiang, where there is an ongoing genocide against the Uighur ethnic minority. The second agent then summarizes the connections and creates a PowerPoint report. Watch the video to see the chat flow in action!
Chaining Multiple Agents in Chatflow Video
Transcript
0:01 Giving your agents access to tools is one way to make their responses more accurate and more specific. But with complicated prompts or prompts that require multiple steps to complete, getting consistent results can be more difficult.
0:14 Now one way to address this is by chaining multiple agents together in a single chat flow. And this is an example of how that looks.
0:23 So most of the features in this chat flow should be pretty familiar at this point. We've got a salary search tool here connected to the first agent and a powerpoint creator tool here connected to the second.
0:35 And so the first agent is going to use the salary search tool to respond to the user query. It's going to produce an output prediction, which is going to be fed into the prompt for the next agent, which is going to use the powerpoint tool to produce a final report.
0:51 So the only thing that we haven't really used much so far is these prompt templates. So each prompt template requires that we define what the question or input is.
1:01 So as you can see here, the question is whatever the user is inputting. We actually need to define how that relates to what the actual end product needs to be.
1:12 So in this case, we're asking this agent to use the salary search tool to identify connections between a given entity either a person or a company and a china.
1:24 And that's going to produce an output prediction just fed into this prompt. So this text here refers to the output prediction.
1:34 So the output from the first agent is going to be fed in here and then this agent is going to determine based on that information based on the output from the previous agent.
1:47 Whether the entity in question, which again is the entity that we specify when we first use, when we first enter an input into this, into this agent's chat box.
2:00 Whether it has any supply chain connections to Xinjiang, which is in China where according to the United States government, there's an ongoing genocide against members of the Uighur ethnic minority.
2:11 Then it's going to summarize those connections in the final and create a PowerPoint with that information. So it's a simple two step chat flow with two different agents.
2:23 The first one is going to do some background research and the second is going to gather that into a report along with some analysis.
2:32 So let me show you how that looks in practice. So I'm going to simply enter the name of a company and let's go with Tencent.
2:42 The first agent is going to search Sayari for connections to China. And as you can see, unsurprisingly since Tencent is a Chinese company, it's identified a number of those.
2:51 And then the second agent based on that intermediate answer is creating a PowerPoint with its determination about whether there are connections between Tencent and Xinjiang.
3:03 And it's found that there are a number of those. So the PowerPoint is here. This can be downloaded. It can be edited.
3:09 And as you can see, this is an excellent way to Simplify the task that each agent needs to perform so that you get a more consistent output.
In this video, I demonstrate how to chain multiple agents together in a single chat flow to improve response accuracy and specificity. I showcase a two-step chat flow with two different agents: one for background research and the other for gathering information and analysis. The first agent uses a salary search tool to identify connections between a given entity and China, while the second agent determines if the entity has any supply chain connections to Xinjiang, where there is an ongoing genocide against the Uighur ethnic minority. The second agent then summarizes the connections and creates a PowerPoint report. Watch the video to see the chat flow in action!
Chaining Multiple Agents in Chatflow Video
Transcript
0:01 Giving your agents access to tools is one way to make their responses more accurate and more specific. But with complicated prompts or prompts that require multiple steps to complete, getting consistent results can be more difficult.
0:14 Now one way to address this is by chaining multiple agents together in a single chat flow. And this is an example of how that looks.
0:23 So most of the features in this chat flow should be pretty familiar at this point. We've got a salary search tool here connected to the first agent and a powerpoint creator tool here connected to the second.
0:35 And so the first agent is going to use the salary search tool to respond to the user query. It's going to produce an output prediction, which is going to be fed into the prompt for the next agent, which is going to use the powerpoint tool to produce a final report.
0:51 So the only thing that we haven't really used much so far is these prompt templates. So each prompt template requires that we define what the question or input is.
1:01 So as you can see here, the question is whatever the user is inputting. We actually need to define how that relates to what the actual end product needs to be.
1:12 So in this case, we're asking this agent to use the salary search tool to identify connections between a given entity either a person or a company and a china.
1:24 And that's going to produce an output prediction just fed into this prompt. So this text here refers to the output prediction.
1:34 So the output from the first agent is going to be fed in here and then this agent is going to determine based on that information based on the output from the previous agent.
1:47 Whether the entity in question, which again is the entity that we specify when we first use, when we first enter an input into this, into this agent's chat box.
2:00 Whether it has any supply chain connections to Xinjiang, which is in China where according to the United States government, there's an ongoing genocide against members of the Uighur ethnic minority.
2:11 Then it's going to summarize those connections in the final and create a PowerPoint with that information. So it's a simple two step chat flow with two different agents.
2:23 The first one is going to do some background research and the second is going to gather that into a report along with some analysis.
2:32 So let me show you how that looks in practice. So I'm going to simply enter the name of a company and let's go with Tencent.
2:42 The first agent is going to search Sayari for connections to China. And as you can see, unsurprisingly since Tencent is a Chinese company, it's identified a number of those.
2:51 And then the second agent based on that intermediate answer is creating a PowerPoint with its determination about whether there are connections between Tencent and Xinjiang.
3:03 And it's found that there are a number of those. So the PowerPoint is here. This can be downloaded. It can be edited.
3:09 And as you can see, this is an excellent way to Simplify the task that each agent needs to perform so that you get a more consistent output.
Updated on: 16/04/2024
Thank you!