
Crewai Multi Agent
Orchestrate multi-agent work with CrewAI Flows when you need branching, typed state, and event-driven steps beyond simple Crews.
Overview
crewai-multi-agent is an agent skill for the Build phase that teaches solo builders how to implement CrewAI Flows with typed state, decorators, and conditional orchestration beyond basic Crews.
Install
npx skills add https://github.com/davila7/claude-code-templates --skill crewai-multi-agentWhat is this skill?
- Decision table: when Crews suffice vs when Flows are required (branching, state, events, hybrid crews-in-steps)
- Typed flow state with Pydantic BaseModel and Flow[MyState] for predictable shared state
- Decorator model: @start entry, @listen chaining, @router branching, plus or_/and_ combinators
- Runnable kickoff() pattern with post-run access to flow.state
- Supports embedding Crews inside Flow steps for hybrid orchestration
- 6-row Crews vs Flows comparison table in the guide
Adoption & trust: 763 installs on skills.sh; 27.8k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need multi-agent automation with branching and shared state, but Crew-only setups cannot express event-driven paths or hybrid crew steps cleanly.
Who is it for?
Indie builders already using CrewAI in Python who are outgrowing linear crew chains and need explicit flow graphs.
Skip if: Teams wanting a no-code agent builder or a single-shot prompt template without Python orchestration code.
When should I use this skill?
You are implementing or refactoring CrewAI orchestration and need Flows for conditional branching, state, or hybrid crew steps.
What do I get? / Deliverables
You get runnable Flow class patterns with @start/@listen wiring, typed state, and clear criteria for choosing Flows over Crews for your next agent feature.
- Flow class with typed state and decorator-wired steps
- Documented choice of Flows vs Crews for the scenario
Recommended Skills
Journey fit
Agent orchestration code belongs in the Build phase where you wire multi-agent systems and execution graphs. Flows, decorators, and state models are core agent-tooling patterns, not generic backend CRUD.
How it compares
Use for graph-style agent orchestration in code, not as a generic MCP server or a one-agent chat skill.
Common Questions / FAQ
Who is crewai-multi-agent for?
Solo and indie developers building Python-based multi-agent apps with CrewAI who need Flows for branching, state, and event-driven steps.
When should I use crewai-multi-agent?
During Build agent-tooling when you are implementing conditional workflows, complex shared state, parallel @start entry points, or Crews embedded inside Flow steps.
Is crewai-multi-agent safe to install?
Treat it as documentation-style procedural knowledge; review the Security Audits panel on this Prism page and inspect the skill source in your repo before granting agent permissions.
SKILL.md
READMESKILL.md - Crewai Multi Agent
# CrewAI Flows Guide ## Overview Flows provide event-driven orchestration with precise control over execution paths, state management, and conditional branching. Use Flows when you need more control than Crews provide. ## When to Use Flows vs Crews | Scenario | Use Crews | Use Flows | |----------|-----------|-----------| | Simple multi-agent collaboration | ✅ | | | Sequential/hierarchical tasks | ✅ | | | Conditional branching | | ✅ | | Complex state management | | ✅ | | Event-driven workflows | | ✅ | | Hybrid (Crews inside Flow steps) | | ✅ | ## Flow Basics ### Creating a Flow ```python from crewai.flow.flow import Flow, listen, start, router, or_, and_ from pydantic import BaseModel # Define state model class MyState(BaseModel): counter: int = 0 data: str = "" results: list = [] # Create flow with typed state class MyFlow(Flow[MyState]): @start() def initialize(self): """Entry point - runs first""" self.state.counter = 1 return {"initialized": True} @listen(initialize) def process(self, data): """Runs after initialize completes""" self.state.counter += 1 return f"Processed: {data}" # Run flow flow = MyFlow() result = flow.kickoff() print(flow.state.counter) # Access final state ``` ### Flow Decorators #### @start() - Entry Point ```python @start() def begin(self): """First method(s) to execute""" return {"status": "started"} # Multiple start points (run in parallel) @start() def start_a(self): return "A" @start() def start_b(self): return "B" ``` #### @listen() - Event Trigger ```python # Listen to single method @listen(initialize) def after_init(self, result): """Runs when initialize completes""" return process(result) # Listen to string name @listen("high_confidence") def handle_high(self): """Runs when router returns 'high_confidence'""" pass ``` #### @router() - Conditional Branching ```python @router(analyze) def decide_path(self): """Returns string to route to specific listener""" if self.state.confidence > 0.8: return "high_confidence" elif self.state.confidence > 0.5: return "medium_confidence" return "low_confidence" @listen("high_confidence") def handle_high(self): pass @listen("medium_confidence") def handle_medium(self): pass @listen("low_confidence") def handle_low(self): pass ``` #### or_() and and_() - Conditional Combinations ```python from crewai.flow.flow import or_, and_ # Triggers when EITHER condition is met @listen(or_("success", "partial_success")) def handle_any_success(self): pass # Triggers when BOTH conditions are met @listen(and_(task_a, task_b)) def after_both_complete(self): pass ``` ## State Management ### Pydantic State Model ```python from pydantic import BaseModel, Field from typing import Optional class WorkflowState(BaseModel): # Required fields input_data: str # Optional with defaults processed: bool = False confidence: float = 0.0 results: list = Field(default_factory=list) error: Optional[str] = None # Nested models metadata: dict = Field(default_factory=dict) class MyFlow(Flow[WorkflowState]): @start() def init(self): # Access state print(self.state.input_data) # Modify state self.state.processed = True self.state.results.append("item") self.state.metadata["timestamp"] = "2025-01-01" ``` ### State Initialization ```python # Initialize with inputs flow = MyFlow() result = flow.kickoff(inputs={"input_data": "my data"}) # Or set state before kickoff flow.state.input_data = "my data" result = flow.kickoff() ``` ## Integrating Crews in Flows ### Crew as Flow Step ```python from crewai import Crew, Agent, Task, Process from crewai.flow.flow import Flow, listen, start class ResearchFlow(Flow[ResearchState]): @start() def gather_requirements(self): return {"topic": self.state.topic}