CrewAI Multi-Agents

Course Content

CrewAI Multi-Agents

9 sections · 53 lessons

How do you break down a complex problem into multiple CrewAI tasks?


Nine tasks by field, or four by documentSplit by field (9 tasks)• About 4 minutes per application• About Rs 22 per application• Facts lost between handoffs• Missing documents cause guessesSplit by document (4 tasks)• About 90 seconds, two in parallel• About Rs 9 per application• Each extraction sees its whole file• A Flow router skips absent documents
Good task boundaries follow deliverables and tools, so each agent sees a whole document instead of one field of it.

What you need to know

Three tests for a task boundary

  • Checkable — you can write an expected_output and ideally a schema for it.
  • Coherent — one skill, one set of tools, one credential.
  • Describable — you can say what its output looks like in one sentence.

Example: a due-diligence memo on a startup

  1. gather_public_data — filings, funding, headcount; search and scrape tools; outputs typed facts.
  2. analyse_market — market size and competitors; context=[gather_public_data]; async_execution=True.
  3. analyse_risks — legal and financial risks; context=[gather_public_data]; async_execution=True.
  4. write_memo — context=[analyse_market, analyse_risks]; writer agent; output_pydantic=Memo.
  5. review_memo — critic agent; context=[gather_public_data, write_memo]; a structured verdict.

Tasks 2 and 3 do not depend on each other, so they run at the same time. Task 4 waits for both.

Python
market = Task(description="...", expected_output="...", agent=analyst,              context=[facts], async_execution=True)risks = Task(description="...", expected_output="...", agent=risk_analyst,             context=[facts], async_execution=True)memo = Task(description="...", expected_output="...", agent=writer,            context=[market, risks], output_pydantic=Memo)

When to stop splitting

  • Each task adds a prompt (persona, description, context) and at least one model call.
  • Each handoff can lose information, because only the output text crosses over.
  • Merge tasks that always succeed or fail together, such as "extract fields" and "format fields".

When a crew is the wrong container

If the plan needs "if the score is above 70, do X, else Y" or "repeat until approved", use a Flow: @router for the branch, plain Python for the loop, and small crews inside the steps.

A real-life example

A loan-document review crew started with 9 tasks: one per document field plus checks. It took 4 minutes and about Rs 22 per application, and information was often lost between tasks — the "employer name" task did not know which payslip page the "salary" task used.

The team regrouped by document and skill:

  1. extract_payslips and extract_bank_statement — parallel, one agent each.
  2. check_policy — joins both, outputs PolicyResult.
  3. write_credit_note — the officer's summary.

Four tasks instead of nine. Time fell to about 90 seconds, cost to about Rs 9, and cross-field errors dropped because each extraction saw its whole document. Applications with a failed policy check are now routed by a Flow's @router to a human, which the crew itself could not express cleanly.

Follow-up questions to expect

  • "How do you know you have too many tasks?" — Handoffs losing facts, tasks that always pass together, and total latency growing faster than quality.
  • "How do you run two tasks in parallel?" — async_execution=True on both, then a later task with context on both to join them.
  • "Where do conditionals go?" — A Flow @router between crews, or a ConditionalTask inside a crew for a simple "skip this task if" rule.