[Hands-on] Building A Multi-agent News Generator
...using Cohere’s Command R7B and CrewAI.
...using Cohere’s Command R7B and CrewAI.

TODAY'S ISSUE
We talked about Cohere’s latest Command R-7B model last week.
It’s a multilingual 7B-parameter open-weight model specialized in enterprise-focused LLM use cases…
…and outperforms other similarly sized open-weight models in core business use cases such as RAG, tool use, and AI agents.
Today, let’s build a multi-agent news generator using this model:

The app will take a user query, search the web for it, and turn it into a well-crafted news article with citations!
Here’s our tech stack for this demo:
We’ll have two agents in this multi-agent app:
1) Research analyst agent:
2) Content writer agent:
If you prefer to watch, we have added a video demo below:
You can find the entire code in this GitHub repository: AI Engineering Hub.
Let’s build this application!
Create a .env file for their corresponding API keys:
Next, setup the LLM and web search tool as follows:

In the above code, we define the LLM and the search tool.
Notice the use of temperature in this code. We discussed what it is in yesterday’s issue.
This agent will take a user query and then use the Serper web search tool to fetch results from the internet and consolidate them:

This is implemented below:

Here, we define our first agent and its goal. Along with that, we also give it access to the tools and the LLM.
Next, we must also create a task for it.
Below, we assign the research analyst agent a research task with a description and expected output:

The role of the content writer is to use the curated results and turn them into a polished, publication-ready news article.
The agent, like Agent 1, is defined below:

Let’s also give it its job, where we describe its writing task with all the details and expected output:

Almost done!
Below, we build our crew of agents and run the multi-agent app:

This produces the following output:

Perfect, it works as expected!
You can find all the code and instructions to run in this GitHub repo: AI Engineering Hub.
We launched this repo recently, wherein we’ll publish the code for such hands-on AI engineering newsletter issues.
This repository will be dedicated to:
Find it here: AI Engineering Hub (and do star it).
👉 Over to you: What other topics would you like to learn about?