# How we run customer support with an AI agent

The support agent we run on Kortix — connected to Plain, our codebase, and Stripe. It triages and resolves inbound threads, and stops for human approval on anything sensitive.

Canonical page: https://openchatly.com/use-cases/customer-support

We run our own customer support on Kortix with an AI agent connected to Plain
(our support tool), our codebase, and Stripe. Most support questions need
product knowledge, engineering context, and billing data at the same time: a
help-center chatbot can quote documentation but can't read the code behind a
bug, confirm whether a subscription renewed, or take a scoped action on an
account.

This write-up covers how the setup works: the connections, the session model,
and the guardrails.

- **Team:** Kortix — the company behind this platform
- **Support stack:** Plain.com
- **Connected systems:** Codebase · Stripe · Plain
- **Mode:** Trigger-driven · human-gated

## The problem

Support volume grows faster than the team. The questions that matter most are
the ones a canned macro can't answer: "why was I charged twice?", "this button
does nothing", "does your API support X?" Each one needs someone who understands
the product, can read the code, and can check the customer's account — usually a
senior engineer.

A help-desk bot handles the easy questions but not these. Hiring scales linearly
with tickets. And giving a generic AI assistant real access to production
systems is hard to justify in a security review.

## What we built

Our support inbox in **Plain** is connected to an agent running on Kortix. Every
inbound thread spawns its own isolated session with scoped access to the systems
a support issue can touch: the product's knowledge, the codebase, and Stripe. It
investigates, resolves what it can, and stops at a human for sensitive actions.

## How it works

### Copy the setup prompt into a new session

Open your Kortix workspace, start a new session, paste this prompt and send it.
The agent writes the agent file, the support skill and the trigger, and opens
a change request for you to review. Prefer clicks? Choose **Use this
template** instead.

**Setup prompt**

```
Set up a support queue agent in this workspace.

1. Create the agent agents/support-agent.md. Its job is to work the Plain support queue. It may read the codebase and use the PLAIN_API_KEY and STRIPE_SECRET_KEY secrets.

2. Create the skill skills/support-playbook/SKILL.md with these rules:
   - Work every new thread and every customer reply that has no answer yet.
   - For a bug report, search the codebase and recent changes for the code path before you reply.
   - For a billing question, look up the customer's plan, invoices and subscription in Stripe.
   - Resolve the thread when you can answer it fully. Otherwise draft a reply with the diagnosis attached and hand it to a person.
   - Refunds, plan changes and anything that touches a customer's money or account state need my approval. Never do them yourself.
   - Note each resolution that worked, so the next run is faster.

3. Add a cron trigger support-triage to kortix.yaml. It runs the support-agent agent every 15 minutes with the prompt "Load the support-playbook skill and work every new or unanswered thread in Plain."

4. Tell me which of these connectors are not connected yet.

5. Open a change request with all of it. Do not merge it.
```

### Connect your tools

Open **Connectors** in your workspace and connect your code host. Add your
Plain and Stripe API keys as the `PLAIN_API_KEY` and `STRIPE_SECRET_KEY`
secrets. Secrets are encrypted and injected at runtime, scoped to the agents you
grant them to.

- **Plain** (Required):
Reads new support threads and resolves or drafts replies.
- **Stripe** (Required):
Reads the customer's billing state for each thread.
- **GitHub** (Optional):
Searches the code and recent changes behind a bug report.

### Run it once with this prompt

Merge the change request, then start a session with the **support-agent** agent
and send this prompt. Read its replies and drafts before you let
the schedule take over.

**Prompt**

```
Work the Plain support queue once.

1. Pull every new thread and every customer reply without an answer.
2. For a bug report, search the codebase and recent changes for the cause.
3. For a billing question, look up the customer's plan, invoices and subscription in Stripe.
4. Reply directly when you can resolve the thread. Otherwise draft a reply with your diagnosis and leave it for me.
5. If a thread needs a refund or a plan change, stop and ask me before you do anything.
```

### Let the 15-minute schedule take over

The change request added this trigger to `kortix.yaml`. From now on the agent
checks the queue every 15 minutes, each run in a new session on its own cloud
computer.
To change the time, edit the cron line, or open **Triggers** in the workspace.

**kortix.yaml**

```yaml
triggers:
  - slug: support-triage
    name: Support queue triage
    on:
      cron: "0 */15 * * * *"
    run:
      agent: support-agent
      prompt: Load the support-playbook skill and work every new or unanswered thread in Plain.
```

### Hold refunds and plan changes for approval

The agent reads the codebase and Stripe freely and replies in Plain. A refund,
a plan change or any other change to a customer's money or account state stops
for a person. An automated session waits at most 30 minutes for a person, then
stops without changing anything, and the next run asks again.

### Read the triage summary

Each run ends with a short summary of the threads it worked. This is what a run
looks like in the session:

> **Support queue triage · 10:15**
>
> Prompt: Load the support-playbook skill and work every new or unanswered thread in Plain.
>
> Worked **5** threads. Resolved **3** directly, including a double charge that
> was one paid invoice and one pending authorization. Drafted **1** bug
> diagnosis for engineering, and **1** refund request is waiting for approval.

> **Summary**
> Connect the support platform via a **trigger**, give the agent scoped
> **connectors** into the systems an issue can touch, encode product knowledge as
> **skills** and **memory**, and gate sensitive actions behind a human. Each
> inbound thread then runs in its own session.

## Make it do more

Once it works, paste any of these into the same session.

**Spot repeat issues**

```
When three or more threads in one day report the same problem, post one summary to #support with the threads and the likely cause.
```

**Turn answers into help articles**

```
After you resolve a thread that the help docs do not cover, draft a help article from your answer and leave it for review.
```

**Weekly support digest**

```
Every Friday, post to #support the top 5 topics of the week, how many threads you resolved and how many you handed off.
```

## Guardrails

Giving an agent access to the codebase, Stripe, and the support inbox is a
security question as much as a product one. The controls on Kortix:

- **Isolation.** Each thread runs in its own isolated sandbox on its own branch. A
  session can install, run, and experiment to reproduce a bug, and only what it's
  explicitly allowed to send is written back out.
- **Scoped secrets.** The Plain, Stripe, and GitHub credentials are encrypted in
  the secrets manager and injected into the sandbox at runtime, scoped to the agents you grant them to.
- **Human approval gates.** Irreversible actions (money, account state) require a
  person to approve.
- **Everything is code.** The agent's persona, skills, and permissions are files
  in the repo — versioned and changed through a reviewed **change request**
  rather than a dashboard setting.

## The outcome

- **24/7:** Coverage without a night shift
- **First-touch:** Many inbound threads resolved before a human opens them
- **3 systems:** Product knowledge, Stripe, and the codebase in one agent

The agent handles the investigation-heavy tickets that used to pull a senior
engineer off their work, and when it escalates, it escalates with the diagnosis
attached. Customers get an answer to the question at any hour.

The setup relies on four pieces: sandbox isolation to contain each session, a
secrets manager to broker tokens, human approval gates for irreversible actions,
and memory that improves as threads are resolved.
