Week 2 · Lesson 05

Orchestrator

Source of truth for posts and lifecycle. The agent drafts; the orchestrator owns state.

Time · 1 day
Learn
  • Domain entities vs run records
  • Valid status transitions (status machine)
  • What belongs in orchestrator vs agent loop
Build
  1. posts + statuses: draft → pending_approval → approved | changes_requested → …
  2. API: create post, attach run, validate transitions (seed already in server/src/server.js)
  3. 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?