In this post we're going to show how to build an AI agent using CrewAI framework that has the capability to perform dynamic web searches. We'll go over:

Let's install the required dependencies:

Next, we import required libraries.

We're going to be using Tavily as a web search tool as well as Azure as LLM provider:

Now, we're going to define two agents with two separate tasks, one agent will be the researcher (notice that we have defined it with the web search tool), and the other one will be the writer as shown in the code below:

Define the CrewAI tasks for these agents.

Finally, we kickoff the CrewAI tasks: