← Lesson
Split the Task
Joeven
Run
Reset
Python loads on first run
ticket = "job 17 failed timeout also please refund me and write a haiku" def extract(text): out = {"job_id": None, "wants_refund": False, "wants_poem": False} for w in text.replace("-", " ").split(): if w.isdigit(): out["job_id"] = int(w) if "refund" in text: out["wants_refund"] = True if "haiku" in text or "poem" in text: out["wants_poem"] = True return out def next_action(fields): if fields["job_id"] is None: return {"tool": "ask", "reason": "missing job_id"} if fields["wants_refund"]: return {"tool": "handoff", "reason": "refund needs a human"} return {"tool": "get_job", "job_id": fields["job_id"]} fields = extract(ticket) print("fields", fields) print("action", next_action(fields)) print("haiku did not become a tool", next_action(fields)["tool"] != "poem") print("refund did not become a tool", next_action(fields)["tool"] != "refund")
Run to execute this in your browser. Nothing is sent to a server.