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.2
Configure environment variables
Create a The
.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.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
llama-3.3-70b 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:
- Navigate to your project directory:
cd my_agent_team - Update the
.envfile with your Cerebras credentials - Modify
src/my_agent_team/config/agents.yamlto use Cerebras models likecerebras/llama-3.3-70borcerebras/qwen-3-32b - Update
src/my_agent_team/main.pyto 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.Frequently Asked Questions
How do I choose the right Cerebras model for my agents?
How do I choose the right Cerebras model for my agents?
Choose models based on task complexity and performance requirements:
- cerebras/llama-3.3-70b - Best for complex reasoning, long-form content, and tasks requiring deep understanding
- cerebras/qwen-3-32b - Balanced performance for general-purpose applications
- cerebras/llama3.1-8b - Fastest option for simple tasks and high-throughput scenarios
- cerebras/gpt-oss-120b - Largest model for the most demanding tasks
Can I use CrewAI with streaming responses?
Can I use CrewAI with streaming responses?
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.How does agent memory work with Cerebras?
How does agent memory work with Cerebras?
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.
What's the difference between sequential and hierarchical processes?
What's the difference between sequential and hierarchical processes?
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.
How do I handle errors and retries in CrewAI?
How do I handle errors and retries in CrewAI?
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:- Explore examples - Check out CrewAI example projects on GitHub including sales pipelines, research assistants, and travel planners
- Learn advanced features - Read the CrewAI official documentation for in-depth guides on memory, tools, and processes
- Optimize performance - Try different Cerebras models to find the best balance of speed and capability for your use case
- Join the community - Connect with other developers in the CrewAI Discord community for support and inspiration
- Extend capabilities - Explore CrewAI Tools to give your agents access to web search, file operations, and more
- Build production apps - Learn about deployment best practices for taking your agents to production
- Use the latest model
zai-glm-4.6- GLM4.6 migration guide

