Multi-Agent Development with CrewAI

Introduction

Recently, there have been many free APIs available, making it unnecessary to waste resources. To fully leverage the capabilities of large models, multi-agent systems are a great approach.

Issue – Installation

After a recommendation from Cursor, I chose CrewAI as my development object. However, I encountered issues during the installation of CrewAI and was unable to install it successfully. Ultimately, I managed to install it via code.

Install CrewAI via code

Unable to Use Gemini2

When you tell Cursor to use Gemini2 and specify the model as gemini-2.0-flash-exp, it always throws an error. I tried the online documentation from CrewAI and @Doc’s documentation, but it still didn’t work. Eventually, Cursor referred to the source code of CrewAI, and that’s how it finally ran successfully. The key points are as follows:

# LLM Configuration Specification
Use the LLM class from CrewAI for configuration. Key parameters are as follows:
```python
llm = LLM(    model="gemini/gemini-2.0-flash-exp",  # Model Name, use gemini prefix    api_key="xxxx",  # Gemini API Key    temperature=0.7  # Temperature parameter, controls output randomness)
```

Notes:

  1. Do not use the provider parameter.
  2. The model name must have the “gemini/” prefix.
  3. It is recommended to set the temperature to 0.7, but it can be adjusted as needed.
  4. No need to set the base_url parameter.

While developing, you can copy this for Cursor, which should work.

Not All Roles Are Agents

For convenience in development, I first described the requirements to Cursor and then asked him to write a design document.

Update @Design Document.txt, based on my following description, design a requirements document for CrewAI. My requirement is "xxxxx"

In this way, you will receive a document that contains many descriptions of roles and tasks, and you can have Cursor develop based on this @Design Document.

Develop CrewAI applications based on @Design Document

If everything goes smoothly, CrewAI will establish many agents. In reality, you will find that not all agents utilize the large model’s API; those that do not are actually Tools.

Optimize, change agents that do not use LLM to Tools

That should be fine.

Leave a Comment