Week 2 · Lesson 05
Orchestrator
Source of truth for posts and lifecycle. The agent drafts; the orchestrator owns state.
Learn
- Domain entities vs run records
- Valid status transitions (status machine)
- What belongs in orchestrator vs agent loop
Build
posts+ statuses:draft → pending_approval → approved | changes_requested → …- API: create post, attach run, validate transitions (seed already in
server/src/server.js) - Agent writes draft fields; cannot set
published
Checkpoint
Illegal transition draft → published returns an error; DB never lies.
Four notes
- What problem does this layer solve?
- What is allowed to call it?
- What must it never do?
- How do I observe and test it?