DEV Community

Mahesh
Mahesh

Posted on

How to Create Search AI Agent with Langchain & Tavily API

Langchain is one of the best AI Agent development frameworks. Between Google ADK and the Langchain you can find the use case wise popular framework being Langchain.

I decided to explore Langchain with some of the use cases like building search AI agents as one of the starting point. Langchain if used with any coding tool, makes it easy for you to build agents.

Take example of the video above where I have made a process on how to create an agent which would use the Tavily Search API. Which we can use to scrape web for data and build insights.

So building insight based bot is lot easier too. You can start with the sources where you wish to search. You can also let the AI agent figure out what data to give to the web. And then it would explore and find the right insight for you.

So how did I created this search AI agent?

  1. Use langchain as an agent framework.
  2. Use Openrouter for LLM models
  3. Use Search AI Agent like Tavily and use API
  4. Create CLI utility for search agent use case.

There are different types of the search agents. Like say stock search, finance insight of the companies, company insights for P&L and many use cases like this.

Tavily is a good search AI that would help you adapt to your use case. And it can even help with 1000 or so credits with which you can use the prototype for development.

Create a prompt based on what type of the search AI agent. For example you can explain how your CLI based agent you wish to search for and what type of insight you want.

You can then ask the agent to export the search insight into CSV and the excel spreadsheet. This way you would find the agent becomes more useful too.

Check the video above to see my process to build this Search AI Agent.

Top comments (0)