The Response Agent is the fourth and final agent in the pipeline. It reads the risk assessments produced by Agent 3 and drafts two categories of communication: supplier emails requesting status updates on affected purchase orders, and customer notices informing affected customers of potential delays.
All drafts are written to the supplysafe_agent_actions table with status pending_review. Nothing sends without human approval. The manufacturer reviews each draft in the Agent Actions screen of the dashboard and can approve, edit, or reject each one individually.
Step 1 — Read risk assessments from state
The agent reads risk_assessment_ids from the LangGraph state object and fetches the full assessment records from Supabase.
Step 2 — Draft supplier emails
For each flagged supplier with an open purchase order, the agent calls Groq with the following context: supplier name, contact name and email, specific PO number and expected delivery date, the disruption description from the supplier alert, and an instruction to write a professional status request email in NovaBrew's voice. The email is addressed to the specific supplier contact by name and references the specific PO.
Step 3 — Draft customer notices
For each at-risk customer order, the agent calls Groq with: customer company name and contact name, order number, product ordered, scheduled delivery date, the nature of the supply chain situation (without disclosing confidential supplier details), and an instruction to write a proactive, professional delay notice. The email is addressed to the specific customer contact by name.
Step 4 — Draft reorder recommendations
For materials critically below safety stock, the agent drafts an internal procurement recommendation identifying alternative suppliers or emergency reorder quantities.
Step 5 — Write to Supabase
Each draft is written to supplysafe_agent_actions with: action_type (supplier_email / customer_notice / reorder_recommendation), recipient email, subject, draft_content, and status: pending_review.
Step 6 — Write to state
The agent writes draft_action_ids to the LangGraph state object. The pipeline ends.