Skip to main content

What is CrewAI?

CrewAI is an open-source platform designed to orchestrate workflows of complex AI agents, enabling task automation and collaborative decision-making. With CrewAI, you can create teams of AI agents that work together to accomplish sophisticated tasks, from research and content creation to sales pipelines and travel planning. By integrating Cerebras’s ultra-fast inference, your CrewAI agents can process information and make decisions with exceptional speed, making real-time agentic workflows more practical and cost-effective. Learn more at CrewAI’s official documentation.

Prerequisites

Before you begin, ensure you have:
  • Cerebras API Key - Get a free API key here
  • Python 3.10 or higher - CrewAI requires Python 3.10+. Verify your version with python --version
  • Basic understanding of AI agents - Familiarity with agent concepts is helpful but not required

Configure CrewAI with Cerebras

1

Install required dependencies

Install CrewAI and the OpenAI SDK. CrewAI uses the OpenAI SDK under the hood, which makes it compatible with Cerebras’s OpenAI-compatible API.
The python-dotenv package helps manage environment variables securely.
To disable CrewAI’s telemetry (which may show 404 errors), add CREWAI_TELEMETRY_OPT_OUT=true to your .env file.
2

Configure environment variables

Create a .env file in your project directory with your Cerebras API key. This tells CrewAI to use Cerebras’s API endpoint and sets your default model.
The OPENAI_API_BASE variable redirects all OpenAI SDK calls to Cerebras, and OPENAI_MODEL_NAME sets your default model for all agents.
3

Create your first agent

Let’s create a simple research agent that uses Cerebras for ultra-fast inference. This agent will gather and analyze information on any topic you provide.
This example creates a single agent that performs research tasks using Cerebras’s gpt-oss-120b model for fast, high-quality responses.
4

Build a multi-agent workflow

CrewAI’s real power comes from orchestrating multiple agents working together. Here’s a content creation pipeline with three specialized agents that collaborate sequentially.
This example demonstrates how multiple agents collaborate in sequence, with each agent’s output feeding into the next agent’s task through the context parameter.
5

Use CrewAI CLI for project templates

CrewAI provides CLI tools to quickly scaffold new projects with best practices built in. This is the fastest way to start building production-ready agent workflows.
After creating your project, update the configuration to use Cerebras:
  1. Navigate to your project directory: cd my_agent_team
  2. Update the .env file with your Cerebras credentials
  3. Modify src/my_agent_team/config/agents.yaml to use Cerebras models like cerebras/gpt-oss-120b or cerebras/zai-glm-4.7
  4. Update src/my_agent_team/main.py to initialize the Cerebras client with the integration header
When prompted for a model provider during project creation, you can select OpenAI-compatible and then configure Cerebras in your environment variables.
6

Enable memory and context

CrewAI supports agent memory for maintaining context across tasks, making your agents more intelligent and context-aware over time.
With memory enabled, agents can reference previous interactions and maintain context across multiple tasks.

Advanced Configuration

Using Different Models for Different Agents

You can assign different Cerebras models to different agents based on their tasks. Use more capable models for complex reasoning and faster models for simpler tasks to optimize cost and performance.

Enabling Agent Delegation

Allow agents to delegate tasks to other agents for more complex workflows. This creates a hierarchical structure where senior agents can assign work to junior agents.

Using CrewAI Tools

Extend your agents’ capabilities with CrewAI’s built-in tools for web search, file operations, and more. Tools allow agents to interact with external systems and data sources.
Learn more about available tools in the CrewAI Tools documentation.

Frequently Asked Questions

Choose models based on task complexity and performance requirements:
  • cerebras/gpt-oss-120b - Largest model for the most demanding tasks
  • cerebras/zai-glm-4.7 - Advanced 357B parameter model with strong reasoning capabilities
You can mix and match models within the same crew to optimize for both quality and speed.
Yes, CrewAI supports streaming responses from Cerebras models. This is particularly useful for long-running tasks where you want to see progress in real-time. You can use crew.kickoff_async() to stream results as they’re generated.
When you enable memory in CrewAI, agents maintain context across tasks and conversations. This memory is stored locally and used to provide context to the Cerebras models during inference. The ultra-fast inference speed of Cerebras makes it practical to include extensive context without significant latency.Memory can be enabled at both the agent level and crew level for maximum flexibility.
CrewAI supports two main process types:
  • Sequential: Tasks execute one after another in order. Each task’s output can be used as context for the next task. Best for linear workflows like content creation pipelines.
  • Hierarchical: A manager agent delegates tasks to worker agents. Best for complex projects requiring coordination and dynamic task allocation.
CrewAI provides built-in error handling and retry mechanisms. You can configure max retries and error handling at the task level:
For custom error handling, wrap your crew execution in try-except blocks.

Next Steps

Now that you’ve set up CrewAI with Cerebras, explore these resources to build more sophisticated agent workflows: