← Lesson
Roles: Planner, Worker, Critic
Joeven
Run
Reset
Python loads on first run
board = {"goal": "summarize refund policy with a quote", "plan": [], "artifact": None} def planner(board): board["plan"] = [ {"id": 1, "worker": "docs", "intent": "fetch refund policy"}, {"id": 2, "worker": "writer", "intent": "quote the delay in days"}, ] return board["plan"] def docs_worker(step, board): board["artifact"] = { "doc": "Refunds are issued in 5-7 business days after approval.", "id": "kb-44", } return board["artifact"] def writer_worker(step, board): doc = board["artifact"]["doc"] board["draft"] = { "text": "Refunds take 5-7 business days.", "quote": doc, "source": board["artifact"]["id"], } return board["draft"] def critic(board): draft = board.get("draft") or {} issues = [] if "5-7" not in draft.get("text", ""): issues.append("missing delay") if draft.get("source") != "kb-44": issues.append("missing source id") if "quote" not in draft: issues.append("no quote") return {"ok": not issues, "issues": issues} print("PLAN", planner(board)) print("DOCS", docs_worker(board["plan"][0], board)) print("DRAFT", writer_worker(board["plan"][1], board)) print("CRITIC", critic(board)) print("critic tools: none")
Run to execute this in your browser. Nothing is sent to a server.