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 pathNext lesson

A support desk in plain Python

Before any agent, the desk is two Python functions: one finds the order, one writes the reply. CrewAI keeps that shape and lets a model decide.

The shop keeps its orders in a dictionary. A customer writes a message, and two workers deal with it: a clerk who finds the order, and a writer who answers the customer.

Exampledesk.py
ORDERS = {"A17": "shipped on 3 March", "C40": "waiting for stock"}


def look_up(message):
    for word in message.replace("?", "").split():
        if word in ORDERS:
            return f"{word} {ORDERS[word]}."
    return "I could not find that order."


def write_reply(finding):
    return f"Dear customer, {finding}"

look_up scans the message for an order id it knows. write_reply turns what the clerk found into a sentence for the customer. The writer never sees the message, only the clerk's finding.

Example
print(write_reply(look_up("Where is my order A17?")))
Example
print(write_reply(look_up("Where is my order B22?")))

A17 is in the dictionary, so the clerk finds it and the writer passes it on. B22 is not, and the desk says so instead of guessing.

What this code cannot do

Each worker follows exact rules. A message that says "order a17" in lower case, or asks two questions at once, falls through them. The shop also has a rule the code has no place for: a refund needs a manager's approval.

CrewAI keeps the same shape. Each worker becomes an agent with a role, and each job becomes a task; a model reads the words and decides, where this code matches strings. The clerk's dictionary lookup survives as a tool in lesson 8, and the refund rule arrives in lesson 12.

Try it yourself
  • Call look_up("where is order a17?") and read why it fails.
  • Add B22 to ORDERS with any status and run the second example again.
  • Make write_reply add a closing line and print both replies again.

You understood something today that you didn't yesterday.