{
  "name": "Mail Triage Agent",
  "nodes": [
    {
      "id": "mail_trigger",
      "type": "imapTrigger",
      "name": "Receive Email"
    },
    {
      "id": "extract_context",
      "type": "function",
      "name": "Extract Context",
      "code": "return { subject: item.subject, sender: item.from, body: item.text.slice(0, 4000) };"
    },
    {
      "id": "classify_with_llm",
      "type": "llm",
      "name": "Classify Email",
      "prompt": "Classify the email as urgent, normal, newsletter, or spam. Return JSON with category, reason, suggested_reply."
    },
    {
      "id": "human_approval",
      "type": "manual",
      "name": "Approve High Risk Reply"
    },
    {
      "id": "send_draft",
      "type": "gmailDraft",
      "name": "Create Draft"
    }
  ],
  "edges": [
    ["mail_trigger", "extract_context"],
    ["extract_context", "classify_with_llm"],
    ["classify_with_llm", "human_approval"],
    ["human_approval", "send_draft"]
  ]
}
