> For the complete documentation index, see [llms.txt](https://docs.revenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revenium.io/get-started/quickstart/examples/ai-customer-support.md).

# AI Customer Support Agent Example

Measure support deflection by connecting ticket workflows, tool costs, human escalation, and resolved-ticket outcomes.

AI support agents can classify tickets, search knowledge, draft responses, update support systems, and decide when a customer needs a human. The business value is not just ticket volume; it is whether the agent resolves routine work at a lower cost while escalating the cases that still need human judgment.

This example simulates a support queue across three motions — ticket triage, ticket resolution, and escalation handling — with three terminal outcomes per ticket: deflected, escalated, or converted (an upsell or renewal during the support session). The result is a deflection-economics view rather than a deflection-rate count.

For the broader outcome-measurement pattern across these examples, see the [overview page](/get-started/quickstart/examples.md).

## What You'll See

When the run completes, these Revenium views populate with the demo data:

* **ROI dashboard** — support-agent cost vs. deflected human handling cost plus upsell value, with net value.
* **Deflection Rate** — share of tickets resolved without human handling.
* **Outcome Mix** — deflected vs. escalated vs. converted (upsell) vs. unsuccessful tickets.
* **Cost Composition** — AI model spend, tool spend (KB search, CRM lookup, ticket update), and human escalation review cost.
* **Tool Cost ratio** — share of cost driven by support tools vs. the model itself.
* **Traces** — per-ticket sequence of classify → KB search → draft → verify → ticket update.
* **Performance** — transaction count and duration outliers, useful for high-volume support batches.

## Run It

The example scripts ship in the public SDK repo, not on PyPI. Clone the repo first, then run from inside it:

```bash
git clone https://github.com/revenium/revenium-python-sdk.git
cd revenium-python-sdk/examples/agentic_outcomes
pip install revenium-python-sdk
export REVENIUM_API_KEY=rev_sk_...
./load-demo.sh              # loads all three scenarios at once
python support.py --count 5  # or run this scenario directly
```

Set `REVENIUM_API_KEY` (a write-scope key, `rev_sk_…`, generated at [app.revenium.ai → Integrations](https://app.revenium.ai/connections/sdk-setup)) before running. Use `--dry-run` or `--plan` to preview.

## View The Source

The runnable scenario lives in the public SDK:

* **support.py** — [examples/agentic\_outcomes/ directory](https://github.com/revenium/revenium-python-sdk/tree/main/examples/agentic_outcomes)
* **Shared runtime (common.py)** — [examples/agentic\_outcomes/ directory](https://github.com/revenium/revenium-python-sdk/tree/main/examples/agentic_outcomes)
* **Examples README** — [github.com/revenium/revenium-python-sdk/blob/main/examples/agentic\_outcomes/README.md](https://github.com/revenium/revenium-python-sdk/blob/main/examples/agentic_outcomes/README.md)

## Customize

The top of `support.py` exposes the customization points: `SCENARIOS` (triage / resolution / escalation mix and step sequences), `LLM_STEPS` and `TOOL_STEPS` (reusable step templates), `OUTCOME_WEIGHTS` (deflection / escalation / conversion / unsuccessful rates), `UPSELL_VALUE_RANGE`, and the `ESCALATION_TOOL` cost. Tweak to match your support motion. These customization points are documented at the top of each script — see the [examples README and source](https://github.com/revenium/revenium-python-sdk/tree/main/examples/agentic_outcomes).

## Why This Matters

Support automation can look successful if you only count resolved tickets, but cost and escalation behavior change the story. A deflected ticket is valuable when the total cost of the agent and tools is lower than the human work it avoided. This example connects the support workflow, the operational cost, and the ticket outcome so teams can reason about deflection as unit economics.

## Related Views

* [ROI and unit economics](/track-and-control-costs/analyze-roi-and-unit-economics.md)
* [Logs and traces](/optimize-performance/debug-logs-and-traces.md)
* [Latency and performance](/optimize-performance/monitor-latency-and-performance.md)
* [Agent decision costs](/instrument-your-agents/analyze-decision-costs.md)
* [Tool usage](/instrument-your-agents/monitor-agent-tool-usage.md)

## Notes

* Values are illustrative demo values, not support benchmark claims.
* Prompt details in the UI depend on your workspace prompt-capture settings.
* Keep first runs small enough that individual ticket traces are easy to inspect.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.revenium.io/get-started/quickstart/examples/ai-customer-support.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
