CrewAI is a framework for orchestrating autonomous AI agents that collaborate to achieve complex goals. It lets you define agents by specifying roles, goals, and backstories, and then define tasks for them.
This example demonstrates how to build a multi-agent system for analyzing customer support data to identify issues and propose process improvements using Gemini 3 Flash, generating a report intended to be read by a Chief Operating Officer (COO).
The guide will show you how to create a "crew" of AI agents that can do the following tasks:
- Fetch and analyze customer support data (simulated in this example).
- Identify recurring problems and process bottlenecks.
- Suggest actionable improvements.
- Compile the findings into a concise report suitable for a COO.
You need a Gemini API key. If you don't already have one, you can get one in Google AI Studio.
pip install "crewai[tools]"Set your Gemini API key as an environment variable named GEMINI_API_KEY, then
configure CrewAI to use the Gemini model.
import os
from crewai import LLM
gemini_api_key = os.getenv("GEMINI_API_KEY")
gemini_llm = LLM(
model='gemini/gemini-3.7-flash',
api_key=gemini_api_key,
temperature=1.0 # Use the Gemini 3 recommended temperature
)
Define components
Build CrewAI applications using Tools, Agents, Tasks, and the Crew itself. The following sections explain each of these components.
Tools
Tools are capabilities that agents can use to interact with the outside world or perform specific actions. Here, you define a placeholder tool to simulate fetching customer support data. In a real application, you would connect to a database, API or file system. For more information on tools, see the CrewAI tools guide.
from crewai.tools import BaseTool
# Placeholder tool for fetching customer support data
class CustomerSupportDataTool(BaseTool):
name: str = "Customer Support Data Fetcher"
description: str = (
"Fetches recent customer support interactions, tickets, and feedback. "
"Returns a summary string.")
def _run(self, argument: str) -> str:
# In a real scenario, this would query a database or API.
# For this example, return simulated data.
print(f"--- Fetching data for query: {argument}