domains / agent-tooling / crewai-multi-agent-orchestration / crewai
Both copies describe the same CrewAI framework, but they emphasize different, non-overlapping implementation paths. The Orchestra-Research copy is a code-first guide focused on inline Python definitions, CLI project creation, and core object parameters. The sickn33 copy is a configuration-first guide that emphasizes YAML-based agent/task definitions, the @CrewBase decorator pattern, and specific features like the 'planning' flag and 'manager_llm' configuration. Neither copy is a strict reproduction of the other; combining them provides a more complete picture of how to structure a CrewAI project (either via code or YAML) and which advanced features are available.
| Repository | Path |
|---|---|
| Orchestra-Research/AI-Research-SKILLs | 14-agents/crewai/SKILL.md |
| sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills-claude/skills/crewai/SKILL.md |
| Role | Repository | Path |
|---|---|---|
| peer | Orchestra-Research/AI-Research-SKILLs | 14-agents/crewai/SKILL.md |
| peer | sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills-claude/skills/crewai/SKILL.md |
| adapter | sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills/skills/crewai/SKILL.md |
| adapter | sickn33/agentic-awesome-skills | skills/crewai/SKILL.md |
---
name: crewai-orchestration
description: Comprehensive guide to building multi-agent systems with CrewAI, covering both code-first and YAML-configured approaches.
---
# CrewAI Multi-Agent Orchestration
## 1. Setup
Install the framework and tools:
```bash
pip install 'crewai[tools]'
```
## 2. Project Structure
You can define agents and tasks either inline in Python or via YAML configuration files. YAML is recommended for larger projects to separate concerns.
### Option A: Code-First (Inline)
Define agents and tasks directly in your Python script:
```python
from crewai import Agent, Task, Crew, Process
researcher = Agent(
role="Senior Research Analyst",
goal="Discover cutting-edge developments",
backstory="Expert analyst...",
verbose=True
)
research_task = Task(
description="Research {topic}",
expected_output="A detailed report",
agent=researcher
)
```
### Option B: YAML-Configured (Recommended)
Use `config/agents.yaml` and `config/tasks.yaml` with the `@CrewBase` decorator:
```python
from crewai.project import CrewBase, agent, task, crew
@CrewBase
class MyCrew:
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def researcher(self):
return Agent(config=self.agents_config['researcher'])
@crew
def crew(self):
return Crew(agents=self.agents, tasks=self.tasks, process=Process.sequential)
```
## 3. Core Components
- **Agents**: Define `role`, `goal`, `backstory`, and optional `tools`.
- **Tasks**: Define `description`, `expected_output`, and `agent`. Use `context` to pass outputs from previous tasks.
- **Crews**: Group agents and tasks. Choose a `process` type.
## 4. Process Types
- **Sequential**: Tasks run in the order defined. Best for linear workflows.
- **Hierarchical**: An auto-generated manager agent delegates tasks. Use `manager_llm` to specify the model for the manager.
## 5. Advanced Features
- **Memory**: Enable `memory=True` on Agents or Crews for short-term/long-term context.
- **Planning**: Set `planning=True` on the Crew to generate a step-by-step execution plan before kickoff.
- **Flows**: For event-driven, complex state management, consider using CrewAI Flows instead of standard Crews.
## 6. Execution
Run the crew with inputs:
```python
result = crew.kickoff(inputs={"topic": "AI Agents"})
print(result.raw)
```