# How we triage a shared inbox with an AI agent

The inbox agent we run on Kortix — connected to Gmail, a help doc, and Linear. It labels every inbound email, drafts a reply, or files a task, and stops for approval before anything goes to a customer.

Canonical page: https://openchatly.com/use-cases/inbox-triage

A shared inbox is where a small team's requests pile up: support questions,
sales pings, bug reports, and the occasional invoice, all landing in one place
with no owner. Sorting them by hand is the first thing that slips when the team
is busy, and a message sitting unread for a day is a message the sender assumes
was ignored.

We handle this by putting an agent on the inbox. Every inbound email gets read,
labelled, and either drafted a reply or turned into a task. This writes up how we
run that on Kortix — the connections, the steps, and the guardrails.

- **Team:** Kortix
- **Connected systems:** Gmail · Help doc · Linear
- **Trigger:** New inbound email
- **Mode:** Trigger-driven · human-gated

## The problem

The messages that need a fast reply are mixed in with the ones that can wait, and
telling them apart takes a person reading each thread. On a small team that
person is also doing three other jobs, so triage happens in bursts — everything
looks urgent when the inbox is opened once a day, and nothing looks urgent in
between.

Filters and rules help with the obvious cases but not the judgment calls: whether
a message is a real support issue or a sales lead, whether it needs a reply or a
ticket, and what a reasonable answer would be. Those are the parts that actually
take time.

## What we built

Our shared inbox in **Gmail** is connected to an agent running on Kortix. Every
inbound email spawns its own isolated session — a cloud sandbox — with scoped
access to what triage needs: the message, our help doc, and Linear. It reads the
email, applies a label, and then either drafts a reply in Gmail or files a task
in Linear. Anything customer-facing waits for a person before it sends.

## 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 email-triage skill and the
15-minute trigger, and opens a change request for you to review.
Prefer clicks? Choose **Use this template** instead.

**Setup prompt**

```
Set up a shared inbox triage agent in this workspace.

1. Create the agent agents/inbox-triage.md. Its job is to label every new message in the shared Gmail inbox, draft replies from the help doc and file tickets in Linear. It may use the Gmail, Linear and Notion connectors.

2. Create the skill skills/email-triage/SKILL.md with these rules:
   - Give every new thread exactly one label: triage/support, triage/bug, triage/sales, triage/billing or triage/other.
   - For support questions, search the Help Center page in Notion first. Draft a reply only when the doc answers the question. If it does not, label only.
   - Save every reply as a Gmail draft on the thread. Never send.
   - File bug reports and follow-ups in the Support Linear team with a link to the thread. Mark a ticket urgent only for a full outage or data loss.
   - Leave triage/other threads with the label and nothing else.

3. Add a cron trigger inbox-triage-check to kortix.yaml. It runs the inbox-triage agent every 15 minutes with the prompt "Load the email-triage skill and run one complete triage pass over the shared Gmail inbox."

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 Gmail, Linear and Notion.
Credentials are brokered server-side and never enter the agent's machine.

- **Gmail** (Required):
Reads and labels new email and drafts replies.
- **Linear** (Required):
Files a ticket for requests that need follow-up work.
- **Notion** (Required):
Looks up the help doc for a standard answer.

### Run it once with this prompt

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

**Prompt**

```
Run one triage pass over the shared Gmail inbox.

1. Find new threads with no triage label and read each one in full.
2. Give each thread exactly one label: support, bug, sales, billing or other.
3. For support questions, search the Help Center page in Notion. Save a Gmail draft only when the doc answers the question.
4. File each bug report or follow-up in the Support Linear team with a link to the thread.
5. Never send a reply. Every draft waits for a person.
```

### Let the 15-minute schedule take over

The change request added this trigger to `kortix.yaml`. From now on the agent
runs 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: inbox-triage-check
    name: Inbox triage check
    on:
      cron: "0 */15 * * * *"
    run:
      agent: inbox-triage
      prompt: Load the email-triage skill and run one complete triage pass over the shared Gmail inbox.
```

### Hold every reply as a draft

The agent labels, drafts and files tickets on its own. It never sends a
reply, however close the help doc match is. Every customer-facing answer
waits in Gmail as a draft for a person to review and send. When the help doc
does not answer a question, the agent labels the thread and leaves it.

### Read the triaged inbox

Each pass ends with labels, drafts and tickets in place. This is what a run looks like in the session:

> **Inbox triage check · 14:30**
>
> Prompt: Load the email-triage skill and run one complete triage pass over the shared Gmail inbox.
>
> Triaged **9** new threads. Drafted **3** replies from the Help Center and
> filed **2** bugs in the Support team. **1** support question had no match in
> the doc, so it has a label and no draft.

> **The pattern**
> Connect the inbox via a **trigger** on new mail, give the agent scoped
> **connectors** into the help doc, Gmail, and Linear, encode how we triage as
> **skills** and **memory**, and gate every customer-facing reply behind a human.

## Make it do more

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

**Route sales leads**

```
For each thread labeled triage/sales, post the sender's company and a one-line summary to #sales.
```

**Find help doc gaps**

```
Every Friday, list the support questions this week that had no match in the Help Center and propose a heading for each.
```

**Flag angry customers**

```
When a thread reads as frustrated or mentions cancelling, add the label triage/urgent and post its link to #support.
```

## Guardrails

Giving an agent access to the shared inbox is a trust question as much as a
convenience one. The relevant controls on Kortix:

- **Isolation.** Each email runs in its own isolated sandbox. The session can read
  the thread and the help doc it needs, and only the draft or ticket it produces
  is written back out.
- **Scoped secrets.** The Gmail and Linear credentials are encrypted in the
  secrets manager and injected into the sandbox at runtime, scoped to the agents you grant them to.
- **Human approval gate.** Nothing customer-facing sends without a person
  reviewing the draft first — replies land as drafts, not sent mail.
- **Everything is code.** The agent's persona, skills, and permissions are files
  in the repo — versioned and changed through a reviewed **change request**, not a
  dashboard setting.

## The outcome

- **Every email:** Labelled and routed as it lands
- **Drafted:** Common replies written and waiting for a send
- **3 systems:** The help doc, Gmail, and Linear in one agent

The inbox stops being a pile to sort and becomes a list already labelled, with
replies drafted and tickets filed. The team reviews and sends instead of reading
every thread cold, and no message sits unread waiting for someone to notice it.

The setup relies on four pieces: sandbox isolation per email, a secrets manager
to broker the Gmail and Linear tokens, a human approval gate before anything
reaches a customer, and memory that improves as threads are resolved.
