Worker Agent
Ed DonnerLangGraph worker that binds gpt-4o-mini to browse, search, code, file, and notify tools, then keeps going until it can answer or must ask the user.
LangGraph · ChatOpenAI · ToolNode · Playwright · Serper · Wikipedia · Python REPL · Pushover
Overview
Layers 2–3 on the Mental Model. The Worker is the Sidekick graph’s doer. It rewrites a system prompt from success criteria and any prior evaluator feedback, invokes gpt-4o-mini with bound tools, and either routes to the tool node or to the Evaluator when the model replies in text.
Behavior
- Criteria-first prompt. Success criteria and optional rejection feedback are injected every turn.
- Tool-or-evaluate route.
worker_routersends tool calls toToolNode, otherwise to the evaluator (Evaluator-Optimizer producer side). See Building effective agents. - Broad toolkit. Playwright browser, Serper search, Wikipedia, Python REPL, sandbox file tools, and Pushover push.
- Question or final. Instructions force either a clear user question or a finished answer — not both.
- Checkpointed. Runs under the Sidekick
MemorySaverthread id from Gradio setup.
Worker flow
One worker step after START or after tools / evaluator retry. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.
---
config:
theme: default
themeVariables:
background: "#ffffff"
fontSize: "14px"
---
flowchart TB
person[Person]
stateIn[State messages and criteria]
worker["✦ Worker LLM
Evaluator-Optimizer"]
tools[ToolNode]
evaluator["✦ Evaluator"]
person -->|request| stateIn --> worker
worker -->|tool calls| tools --> worker
worker -->|text reply| evaluator
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 worker,evaluator agent
class stateIn,tools service
class person actor
Graph edges: START → worker; tools → worker; text path continues on the Evaluator tab.
Defined in 4_langgraph/sidekick.py (worker, worker_router) with tools from sidekick_tools.py. Layer map on Mental Model; judge on Evaluator. Part of Project.