Mental Model

Homebrewed

Five layers for the OPG Labs mail path — plus which Anthropic workflows sit on Decide and Act.

SES · Lambda · S3 · SQS · SNS · CloudWatch

Overview

The mail path is easiest to hold as five layers. AI steps sit in Decide and Act thank-you; everything else is infrastructure or people. Anthropic names from Building effective agents (PDF).

Applied workflows

  • Routing. Inbound System 1 ranks clean mail into an allowlisted category slug (gpt-4o-mini or Typesafe Jev); thank-you framing uses that label.
  • Parallelization. Forward and thank-you are independent send concerns (separate retries / idempotency). Diagrams show Processing Q and Thank-you Q in parallel; the deployed worker may still run both in one outbound Lambda with per-step skip.
  • Not used here (yet). Prompt Chaining, Orchestrator-Worker, Evaluator-Optimizer.

Layers

  • 1 Ingest. SES receive stores raw MIME under ses-raw/; spam/virus verdicts arrive with the receipt.
  • 2 Decide. Inbound Mail claims the message, ranks category (Routing), stores under inbound/, marks queued.
  • 3 Dispatch. SQS carries the job id (and metadata) to the send worker — claim-check style, not the full MIME.
  • 4 Act. Forward to FORWARD_TO and thank-you to the sender (Parallelization of concerns); each step records DynamoDB send ids.
  • 5 Observe. mail-events (bounce/complaint via SNS), CloudWatch metrics, DLQ alarms.

Layer map

Layer stack for one inbound message — Routing on Decide, Parallelization across Act. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.

---
config:
  theme: default
  themeVariables:
    background: "#ffffff"
    fontSize: "14px"
---
flowchart TB
    person[Person]
    ingest["1 Ingest
SES plus S3 raw"] decide["✦ 2 Decide
Routing"] dispatch["3 Dispatch
SQS outbound"] actFwd["4a Act forward
SES to FORWARD_TO"] actThanks["✦ 4b Act thank-you
Parallelization"] observe["5 Observe
mail-events CloudWatch"] inbox[Personal inbox] reply[Thank-you to sender] person -->|email hello@| ingest --> decide decide -->|action queued| dispatch dispatch --> actFwd --> inbox dispatch --> actThanks --> reply reply --> person ingest -.-> observe 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 decide,actThanks agent class ingest,dispatch,actFwd,observe,inbox,reply service class person actor

Read layers top to bottom; drill into agent tabs for verdicts, queues, and retries.

Use this tab as the layer map and Anthropic workflow callout for Inbound Mail and Outbound Mail. Product overview stays on Project.