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

# Mine automation opportunities into draft agents and flows

> Read the Automation Opportunity Miner — a ranked list of recurring customer intents mined from your recent transcripts — and turn the winners into draft AI agents or flows with the one-click Scaffold button.

# Mine automation opportunities into draft agents and flows

Choosing what to automate next is usually guesswork: you skim a few
conversations, trust your gut, and hope you picked the highest-leverage
workflow. The Automation Opportunity Miner replaces the gut call with a
ranked list. It reads your recent support transcripts, groups them into
recurring customer intents, and ranks each cluster by the deflection and
money an automation could save each month.

This guide covers **AI → Automation Opportunity Miner**
(`/agents/automation-opportunities`) and the two API endpoints behind it.
The goal is the same workflow the page assumes: read what the miner found,
judge whether a cluster is worth automating, scaffold it into a draft, and
review the result before anything goes live.

## What the miner is

For the look-back window you choose, the miner clusters your support
transcripts by intent — "reset password", "track my shipment", "update my
billing details" — and computes two projections per cluster:

* **Projected deflection** — the estimated fraction of those conversations
  an automation would resolve without a human.
* **Projected monthly cost** — the human-agent time that deflection would
  free up, derived from the cluster's volume and your assumed per-
  conversation handling cost.

Ranked by projected monthly savings, the list answers "what should we
automate next?" with the expensive candidate on top, not the loudest one.
The projections are estimates to prioritise with — verify them against the
cluster's example transcripts before you build.

## Reading an opportunity row

Each row in the ranked list carries:

* **Volume and share** — the number of conversations in the cluster and
  its percentage of all analyzed conversations in the window. A thin
  cluster with a high deflection rate is still a thin cluster.
* **Projected deflection** — the integer percentage of the cluster an
  automation could auto-resolve.
* **Projected monthly savings** — the human-agent cost avoided, shown in
  your account currency.
* **Projected ROI** — projected monthly savings divided by the estimated
  build-and-run cost. Shown when it is computable; a high-savings cluster
  with no ROI figure is still scaffoldable.
* **Recommended build** — one of AI agent, flow, KB article, or macro.
  Agents and flows scaffold in one click; articles and macros are guidance
  you build on their own surfaces.

Expand **View example transcripts** on a row to read short, redacted
excerpts from the cluster before you commit. A cluster that mixes two
intents ("cancel order" and "cancel subscription") is a sign to build a
narrower automation than the label suggests.

A row already scaffolded is marked **Scaffolded**, and its button is
disabled so you don't build the same cluster twice.

## Scaffold a winner into a draft

On a row whose recommended build is an AI agent or a flow, click
**Scaffold draft**. Orbit turns the cluster into a DRAFT agent or flow and
drops you straight into the builder to ground it, review it, and publish
it on your own schedule. Nothing activates — the scaffold never wires an
outbound channel or flips any live routing.

What each build type looks like after scaffolding:

* **AI agent** — you land on the agent editor with a starting prompt
  assembled from the cluster's intent. Review it against the
  [agent-from-prompt workflow](/guides/agent-from-prompt): tighten the
  prompt, attach a knowledge base, and set handoff targets before you
  activate.
* **Flow** — you land in the flow builder with a starting graph. Review it
  against the [flows recipes](/guides/flows-recipes): confirm the branch
  conditions and terminal steps, then publish from the builder.

Treat the scaffold as a first draft, not a finished automation. Sequence
your rollout like any other agent launch — evals, guardrails, canary —
before routing real traffic to it.

## Data and API surface

Everything the page shows is available over the API if you want to export
the ranking or scaffold from your own tooling:

```bash theme={null}
curl "https://api.orbit.devotel.io/api/v1/agents/automation-opportunities?days=30&limit=10" \
  -H "X-API-Key: dv_live_sk_..."
```

The response is a report holding the window bounds, the analyzed
conversation count, and the ranked opportunities. Each opportunity carries
its id, title and summary, conversation volume and share, the projected
deflection and savings figures, the recommended build, representative
excerpts, and a scaffolded flag.

To scaffold from the API, post the opportunity id plus the build type:

```bash theme={null}
curl -X POST "https://api.orbit.devotel.io/api/v1/agents/automation-opportunities/OPP_ID/scaffold" \
  -H "X-API-Key: dv_live_sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "automation_type": "ai_agent" }'
```

Pass `ai_agent` or `flow` in `automation_type`, and pass the same `days`
window you listed the opportunity under — the opportunity id is only valid
within the window that minted it, because the scaffold re-derives the
cluster from the id. The response returns the new draft's agent or flow id
plus `draft: true`.

## Tune what you automate

Ranking by projected savings is the starting sort, not the final word.
Adjust what you keep human and what you pass to drafts with two habits:

* **Keep humans on judgement-heavy intents.** Anything involving
  exceptions, goodwill, or account-risk decisions (refund overrides,
  contract disputes, security incidents) tends to show high projected
  deflection but deserves human review. Scaffold it into a flow with an
  explicit human-approval step rather than an autonomous agent.
* **Prefer drafts over rejections.** A cluster you decide not to automate
  still cost your agents time this month. When the recommended build is a
  KB article or macro, build it on that surface instead of scrolling past
  — a thin deflection upgrade beats none.

Adjust the **look-back window** (7 to 90 days, default 30) and the **top
N** list size from the page header. Widening the window catches slower
recurring intents that a 7-day slice misses; narrowing it surfaces the
current week's spike.

## Pitfalls

* **Recent window only.** The miner reads transcripts inside the selected
  window. Seasonal intents that only spike in November never rank if you
  always mine a 7-day window — widen the window around known peaks.
* **Scaffold is always a draft.** The one-click action creates a review
  artifact and deep-links you into its editor. It never activates an
  agent, never publishes a flow, and never connects an outbound channel.
* **Projections are estimates.** Deflection and ROI figures are derived
  from the cluster's traffic and your handling-cost assumption. Check the
  example transcripts before committing build time to a cluster that only
  looks coherent from the ranking.
* **Opportunity ids are window-scoped.** The same intent under a different
  window carries a different id. Like-for-like comparisons or API-driven
  scaffolding must reuse the same `days` value end to end.
