CrewAICrewAI 1.15 · Python 3.10 to 3.13
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
32 small wins to finish your path

A refund waits for the manager

A refund is the one thing the desk will not do on its own. The flow stops, saves itself, and waits for a person's answer.

The same desk, with a ticket that asks for money back.

Example
from crewai.flow.persistence import SQLiteFlowPersistence
from desk import SupportDesk

db = SQLiteFlowPersistence("desk.db")
desk = SupportDesk(persistence=db, suppress_flow_events=True)
pending = desk.kickoff(inputs={"message": "Please refund order A17, it arrived broken."})
flow_id = pending.context.flow_id

The proposal reached the manager and the flow stopped there. Its state is in desk.db, so the process can end and nothing is lost. No refund has been made.

Approved

Example
later = SupportDesk.from_pending(flow_id, db, suppress_flow_events=True)
later.resume("Yes, refund it")
print(later.state.reply)

from_pending rebuilds the flow from the saved state, and resume carries the manager's answer into the second router, which takes the approved path.

Refused

Example
later = SupportDesk.from_pending(flow_id, db, suppress_flow_events=True)
later.resume("No, it was delivered intact")
print(later.state.reply)
The finished support desk
SupportDesk flowanswer_crew()statusrefundwaitsresumeread_ticketfinds the order idroutestatus, refund, no idpropose_refund@human_feedbackdecideapproved or refusedask_for_orderno order idOrder clerkcalls lookup_orderReply writerguardrail checks itThe shop's ordersA17, C40, not B22ManagerInboxpauses and savesdesk.dbthe paused flowstate.replywhat the customer reads
Hover or tap a piece to see what it is and which lesson built it.
Trace a ticket

Pick one to watch it run, step by step.

The whole desk again, now that every path in it has run: the status path through the crew, the missing order, and both ends of the refund.

The same saved ticket, resumed a second time with a different answer, takes the refused path and tells the customer. The flow never reaches pay, which is what the pause is for.

What this course did not cover

CrewAI is large. These are the parts a first course leaves out, and what each is for.

TopicWhat it is for
The CLI and project layoutcrewai create builds a project of YAML files and classes, with run, train, test, replay and chat around it.
YAML crews with @CrewBaseThe same agents and tasks written in YAML files with a class of decorators, which is what the CLI generates.
Knowledge sourcesFiles an agent searches before answering, held in a vector store.
Planning and reasoningA model that writes a plan into every task, or an agent that plans before it starts.
Training and testing a crewcrew.train() feeds human corrections back in; crew.test() scores runs with an evaluator model.
Streaming, checkpointing and replayWatching a run as it happens, saving a crew between tasks, and rerunning from a chosen task.
More hooks and human inputKickoff and step hooks, and human_input=True for a person reviewing at the terminal.
The tool catalogueAbout eighty ready-made tools in crewai-tools for search, scraping, files and databases.
CrewAI AMPThe hosted platform: deployment, tracing and dashboards for crews you have built.
Try it yourself
  • Resume the same flow twice with the same answer and see what the second run does.
  • Add a rule that refunds under 20 need no approval.
  • Store each finished reply in the crew's memory, under the customer's scope.

Little by little, you're building something great.