DEV Community

Cover image for Using Datastax Langflow and AstraDB to Create a Multi-Agent Research Assistant with Safety Check - Part 2: Verify Search
Alan Knox
Alan Knox

Posted on

Using Datastax Langflow and AstraDB to Create a Multi-Agent Research Assistant with Safety Check - Part 2: Verify Search

This is the second part of a multipart post about creating a multi-agent research assistant using Datastax Langflow and AstraDB.

The goal of this post is to explain how multiple Langflow flows and AstraDB 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:

  1. Examine the user's request to determine whether or not it is a safe request.
  2. Find web pages that correspond to the user's request.
  3. Summarize the contents of each web page.

In a previous post, I create two flows that checked the user's topic for safety and also searched the web for websites related to that topic. In this post, I will expand on the web search agent flow to add a verification tool to the agent.

The previous web search agent flow looked like this:

Image description

The agent had access to a web search tool and would return a list of URL's (and only URL's) that it found related to the topic. However, the long term goal is to add these URL's to a database, and to be able to expand the research later. Because of this, I need to verify that the URL's discovered by the web search agent are not already in a database.

AstraDB

To begin, I created a Datastax AstraDB Serverless database, added a collection and keyspace, and uploaded some sample data. The data consists of 15 URL's that the web search agent had found previously. (For now, I loaded the data manually, but will automate the loop in a later step.)

Sample data
Image description

Langflow

Next, I needed to modify the agent flow to include verification. I gave the agent another tool: an AstraDB tool. I connected this tool to my AstraDB collection and instructed the agent how to use it by modifying the agent's system prompt:

Modified agent system prompt to include URL verification from DB:
Image description

After added the new tool and adjusting the agent's system prompt, the modified flow for agent search with verification looks like this:

Web Search and Verification Agent Flow
Image description

And the results were as expected: the modified agent provided a list of non-duplicate websites related to the topic:

Web Search and Verification Agent Results
Image description

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 and compares those websites to those already stored in a database. The next step for the multi-agent research assistant will be to summarize the content of each website. That will be Part 3.

Top comments (0)