This is the first part of a multipart post about creating a multi-agent research assistant using Datastax AstraDB and Langflow.
The goal of this post is to explain how multiple Langflow flows can be integrated to create a multi-agent application. For this project, the application will assist a researcher in finding websites about a particular topic in 3 steps:
- Examine the user's request to determine whether or not it is a safe request.
- Find web pages that correspond to the user's request.
- Summarize the contents of each web page.
Part 1: Safety and Search
For any AI project, observability and safety are ultimate concerns. When I design an AI project, I begin and end with observability and safety. It's important to know what's happening throughout the application, and to ensure that the application is returning safe outputs to the user.
For the "Safety Check", I created a simple flow using Langflow:
This flow accepts the user's input and provides a system prompt to the model which then provides the output.
The important part of this flow is the system prompt. I begin with a simple system prompt to test the flow:
Simple SafetyCheck System Prompt
Simple SafetyCheck System Prompt Results
Next, I optimized the system prompt to include additional unsafe parameters as well as to block against prompt injection:
Optimized SafetyCheck System Prompt
Optimized SafetyCheck System Prompt Results
Web Search
For the second section of Part 1, I create an agent that can search the web based on the user's input. It's important that the agent only returns a list of URL's, so once again prompt engineering is necessary.
Also, in order to demonstrate the flexibility of Langflow, I use OpenAPI models for this agent.
Here is the final agentic flow:
I begin with a simple prompt until I get the results that I want:
Web search agent simple prompt
Web search agent results with simple prompt
Next, I optimized the prompt. The optimized prompt was more concise and added an example. The results were also good.
Web search agent optimized prompt
Web search agent optimized prompt results
At this point, I have a flow that checks my user's input for safety. I also have an agent that returns a list of websites. The next step for the multi-agent research assistant will be to search each website and summarize the contents. That will be Part 2.
Top comments (0)