> ## Documentation Index
> Fetch the complete documentation index at: https://labs.prompthon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer Support Email Agent Starter

<div className="not-prose my-4 rounded-md border border-gray-200 bg-gray-50 p-2 text-sm dark:border-gray-800 dark:bg-gray-900/40">
  <div className="mb-2 px-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Need help?</div>

  <div className="flex flex-wrap gap-2">
    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://discord.gg/sDE2HhGTg4" target="_blank" rel="noreferrer">
      <Icon icon="discord" iconType="brands" size={14} />

      <span>Ask in Discord</span>
    </a>

    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://github.com/Prompthon-IO/agent-systems-handbook/issues/new/choose" target="_blank" rel="noreferrer">
      <Icon icon="github" iconType="brands" size={14} />

      <span>Open a GitHub issue</span>
    </a>

    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://github.com/Prompthon-IO/agent-systems-handbook/blob/main/SUPPORT.md" target="_blank" rel="noreferrer">
      <Icon icon="life-ring" size={14} />

      <span>Support guide</span>
    </a>
  </div>
</div>

## Summary

This starter turns the customer-support case study into a small local workflow:
read an inbound customer email, read a local support policy document, classify
the case, and draft a safe reply for human review.

## Status

`starter`

Source code: [case-studies/examples/customer-support-email-agent-starter](https://github.com/Prompthon-IO/agent-systems-handbook/tree/main/case-studies/examples/customer-support-email-agent-starter)

## Why It Exists

Customer support is a practical local-agent shape because the useful context is
often already nearby: an email export, a policy document, a refund rule, or an
FAQ file. This starter keeps that boundary visible by requiring explicit local
paths instead of pretending the agent knows the policy from memory.

## Related Lab Pages

* [Customer Support Agents](/case-studies/customer-support-agents)
* [Case Studies Overview](/case-studies)
* [Protocols And Interoperability](/systems/protocols-and-interoperability)

## Folder Structure

```text theme={null}
customer-support-email-agent-starter/
├── index.mdx
├── skill/
│   └── SKILL.md
└── src/
    ├── email_triage.py
    ├── policy_loader.py
    └── reply_guardrails.py
```

## Quick Start

This is a starter, not a finished helpdesk integration. The code sketch uses
only the Python standard library and focuses on the local-path boundary.

Example:

```python theme={null}
from reply_guardrails import draft_policy_grounded_reply

result = draft_policy_grounded_reply(
    email_text="Subject: Refund request\nI received the wrong item.",
    policy_path="/Users/example/support/refund-policy.md",
)

print(result.reply_subject)
print(result.reply_body)
print(result.needs_human_review)
```

For a repo-level smoke check, run `python3 scripts/verify_example_projects.py`
from the repository root.

## Included Sample Files

* `skill/SKILL.md`: skill instructions for checking customer email and drafting
  policy-grounded replies from a local document path
* `src/email_triage.py`: lightweight classification and summary helpers
* `src/policy_loader.py`: local policy loading and evidence extraction helpers
* `src/reply_guardrails.py`: draft generation and human-review guardrails

## Constraints

* No mailbox, Gmail, CRM, or helpdesk adapter is implemented.
* The starter reads local text-like policy files only.
* Drafts are intended for human review, not automatic sending.
* Classification is keyword-based and intentionally small.

## Next Steps

* Add a mailbox adapter that writes inbound messages to explicit local paths.
* Add structured policy sections with stronger retrieval.
* Add evaluation fixtures for refunds, billing, complaints, and escalation.
* Add an audit artifact that records policy evidence and reviewer decision.
