Mental Model
Ed DonnerFive layers for LangGraph Sidekick — Intake through Return — plus which Anthropic workflows the Worker and Evaluator use.
LangGraph · Gradio · ChatOpenAI · ToolNode · MemorySaver
Overview
The co-worker loop is easiest to hold as five layers. AI sits in Work and Evaluate; Intake, Act, and Return are Gradio input, tools, and UI output. Anthropic names from Building effective agents (PDF).
Applied workflows
- Evaluator-Optimizer. Worker produces a reply; Evaluator scores it against success criteria and either ends or loops the worker with feedback.
- Not used here (yet). Routing, Parallelization, Prompt Chaining, Orchestrator-Worker — one worker / evaluator pair in a LangGraph, not a multi-worker fan-out.
Layers
- 1 Intake. Gradio collects request + success criteria;
run_superstepseeds graph state and aMemorySaverthread id. - 2 Work. Worker rewrites its system prompt from criteria (and prior feedback), invokes
gpt-4o-miniwith bound tools. - 3 Act.
worker_routersends tool calls toToolNode(Playwright, Serper, Wikipedia, REPL, sandbox files, Pushover), then back to Work. - 4 Evaluate. Evaluator returns structured
EvaluatorOutput: feedback,success_criteria_met,user_input_needed. - 5 Return. On success or clarify need, graph ends; Gradio shows assistant reply plus evaluator feedback. Otherwise Evaluate routes back to Work.
Layer map
Layer stack for one Gradio Go. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.
---
config:
theme: default
themeVariables:
background: "#ffffff"
fontSize: "14px"
---
flowchart TB
person[Person]
intake["1 Intake
request and criteria"]
work["✦ 2 Work
Evaluator-Optimizer"]
act["3 Act
ToolNode"]
evaluate["✦ 4 Evaluate
Evaluator-Optimizer"]
returnNode["5 Return
reply and feedback"]
person -->|Go| intake --> work
work -->|tool calls| act --> work
work -->|text| evaluate
evaluate -->|retry| work
evaluate -->|done or clarify| returnNode --> person
classDef agent fill:#e8f0ee,stroke:#0f3d36,stroke-width:2px,color:#0d0d0d
classDef service fill:#fafaf8,stroke:#c8c8c2,stroke-width:1px,color:#0d0d0d
classDef actor fill:#f3eef8,stroke:#6b4f9a,stroke-width:2px,color:#0d0d0d
class work,evaluate agent
class intake,act,returnNode service
class person actor
Read layers top to bottom; drill into agent tabs for prompts and routing helpers.