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

# Customer support triage

> Multi-agent handoff (triage -> billing/technical) with PII redact + rehydrate inside a declaw base sandbox.

## Use case

A support ticket comes in containing an email, a phone number, and
a complaint that spans billing and a product bug. A triage agent
classifies it, hands off to specialists, and each specialist runs
tools in the **same** sandbox — so filesystem state persists across
the handoff.

## Template

`base` — the smallest template, boots fastest. All this recipe
needs is a shell and `/workspace`.

## Run it

```bash theme={null}
export DECLAW_API_KEY=dcl_...
export DECLAW_DOMAIN=api.declaw.ai
export OPENAI_API_KEY=sk-...

python cookbook/examples/openai-agents-customer-support/main.py
```

## Security policy

```python theme={null}
SecurityPolicy(
    pii=PIIConfig(enabled=True, action="redact", rehydrate_response=True),
    network=NetworkPolicy(allow_out=["api.openai.com"]),
)
```

`rehydrate_response=True` is the key knob for support workflows.
Walk-through:

1. User ticket contains `alice.johnson@example.com` and
   `+1-415-555-0182`.
2. Triage agent needs to send the ticket to the LLM. Outbound
   request is scanned — email and phone become
   `REDACTED_EMAIL_ADDRESS_1`, `REDACTED_PHONE_NUMBER_1`.
3. LLM reasons about the redacted ticket. Its response echoes the
   tokens back in the reply draft.
4. Edge proxy rehydrates the tokens before the sandbox receives
   the response. The agent's drafted reply now contains the real
   email and phone.
5. Specialist writes the final reply to `/workspace/reply.txt`
   with the real PII — correct for the *customer*, while the LLM
   never saw real values.

## Multi-agent handoff

```python theme={null}
triage_agent = SandboxAgent(
    name="triage",
    handoffs=[billing_agent, technical_agent],
    ...
)
```

Both specialists run inside the same `session`. Triage writes
`/workspace/ticket.txt`; billing reads it; billing writes
`/workspace/billing.log`; technical appends to
`/workspace/reply.txt`. That would not work if each agent got its
own sandbox.

## Env isolation

```python theme={null}
envs={"SUPPORT_TIER": "gold", "AGENT_VERSION": "v3"}
```

Specialists read these with `printenv` so they branch on tier
(gold/silver/bronze) or agent version without the dispatcher
needing to pass them in the prompt.

## Full source

See `cookbook/examples/openai-agents-customer-support/main.py` in the repo.
