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

# Sales Triage walkthrough

> A complete worked example — three AI agents, two routing edges, a widget channel, a deployed live conversation. Concepts in action.

This guide walks through the same flow used as the running example throughout these docs: a **Sales Triage** flow with three AI agents. By the end you'll have a deployed flow you can talk to, a test session that demonstrates routing, and a clear mental model for building your own multi-agent flows.

Estimated time: 20 minutes.

## What we're building

```mermaid theme={null}
flowchart TB
    Start([Start<br/>Acme website widget])
    Triage[Triage Agent<br/>greets, identifies intent]
    Product[Product Specialist<br/>features, integrations, security]
    Pricing[Pricing Specialist<br/>plans, quotes, free trial]

    Start --> Triage
    Triage -->|Product| Product
    Triage -->|Pricing| Pricing
```

A user opens the chat widget on `acme.com`, asks a question, gets routed to the right specialist, gets an answer that uses the company's own context.

## Step 1 — Create the flow

<Steps>
  <Step title="Open Conversations">
    From the workspace sidebar, click **Conversations** → **New Flow**. A blank flow opens.
  </Step>

  <Step title="Rename">
    Double-click "Untitled Flow" at the top and rename to **Sales Triage**.
  </Step>
</Steps>

## Step 2 — Set the global context

Every actor will inherit this. We write it once.

<Steps>
  <Step title="Open Flow settings">
    Click the **gear** icon in the bottom-right toolbar.
  </Step>

  <Step title="Paste the global context">
    In the **Global Context** field:

    ```
    You work for Acme Inc., a SaaS platform that sells two products:

    - Acme Pro — a self-serve workflow builder, $49/seat/month, 14-day free trial.
    - Acme Enterprise — adds SSO, SLAs, a dedicated success manager, and audit
      logs. Custom pricing, annual contract.

    Always be friendly, concise, and professional.
    ```
  </Step>

  <Step title="Save and close">
    Click **Save Changes**, then close the panel.
  </Step>
</Steps>

## Step 3 — Create the Triage agent

<Steps>
  <Step title="Click Add Actor">
    In the bottom toolbar. Name it **Triage** and click **Create**.

    Triage appears on the canvas, connected from Start.
  </Step>

  <Step title="Click Triage to open its config">
    The right-side panel opens.
  </Step>

  <Step title="Fill in three fields">
    | Field                  | Value                                                                                                                                                                                                               |
    | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Context**            | *Leave blank.* It inherits global context.                                                                                                                                                                          |
    | **Instructions**       | `Greet the user and ask one short qualifying question to figure out whether they want to talk about product features or pricing. As soon as you know which one, hand off — don't try to answer specifics yourself.` |
    | **Definition of Done** | `The user's intent is clear (product vs pricing) and the conversation has been handed off to the right specialist.`                                                                                                 |
  </Step>

  <Step title="Save">
    Click **Save Changes**.
  </Step>
</Steps>

## Step 4 — Create the two specialists

Repeat the Add Actor flow twice.

<Tabs>
  <Tab title="Product Specialist">
    | Field            | Value                                                                                                                                                              |
    | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | **Name**         | Product Specialist                                                                                                                                                 |
    | **Context**      | `You are the product expert for Acme Inc. You know everything about Acme Pro and Acme Enterprise — features, integrations, security, supported channels, roadmap.` |
    | **Instructions** | `Answer product questions in clear, plain language. If the user asks about pricing or plans, hand off — don't quote prices.`                                       |
  </Tab>

  <Tab title="Pricing Specialist">
    | Field                  | Value                                                                                                                                                                                                       |
    | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Name**               | Pricing Specialist                                                                                                                                                                                          |
    | **Context**            | `You handle pricing questions for Acme Inc. You know the seat-based Pro pricing, the volume discount tiers, the Enterprise commercial model (annual contract, custom quote), and the free-trial mechanics.` |
    | **Instructions**       | `Answer pricing questions plainly. If the user asks about deep product features that aren't pricing-related, hand off — don't try to spec the product.`                                                     |
    | **Definition of Done** | `The user has a clear answer about pricing or has been booked for an Enterprise quote call.`                                                                                                                |
  </Tab>
</Tabs>

After both are saved, you have four nodes on the canvas. Both specialists are auto-wired from Start — we'll fix that next.

## Step 5 — Wire routing edges

We want **Start → Triage**, then **Triage → Product** and **Triage → Pricing**.

<Steps>
  <Step title="Delete the auto-wired edges from Start to specialists">
    Click the line connecting Start to Product Specialist. Press Delete. Repeat for Start → Pricing Specialist.

    Only **Start → Triage** remains.
  </Step>

  <Step title="Draw Triage → Product Specialist">
    Hover the bottom of the Triage node. Drag the handle that appears onto the Product Specialist node. An edge appears.
  </Step>

  <Step title="Click the new edge and add an activation prompt">
    > When the user asks about product features, integrations, capabilities, security, the roadmap, or how something works in the product.

    Click **Save**. A short label appears on the edge ("Product"), auto-generated by AI from the prompt.
  </Step>

  <Step title="Repeat for Pricing Specialist">
    Draw Triage → Pricing Specialist, click the edge, paste:

    > When the user asks about price, plans, seats, discounts, free trial, or wants a quote for an Enterprise contract.

    Save. The "Pricing" label appears.
  </Step>
</Steps>

Your canvas now matches the diagram at the top of this guide.

<Frame>
  <img src="https://mintcdn.com/glorium/eqWkhSfBUec9afZU/images/conversation-flows/canvas-overview.png?fit=max&auto=format&n=eqWkhSfBUec9afZU&q=85&s=9f0b09eb9e687847b6e4742d3168d09d" alt="Sales Triage flow on canvas" width="1471" height="1225" data-path="images/conversation-flows/canvas-overview.png" />
</Frame>

## Step 6 — Configure the widget channel

<Steps>
  <Step title="Open Flow settings → Channels">
    Click the gear icon, then the **Channels** tab.
  </Step>

  <Step title="Add a Widget channel">
    Click **Add Channel** → **Widget**.

    | Field    | Value                                                                         |
    | -------- | ----------------------------------------------------------------------------- |
    | Name     | Acme website widget                                                           |
    | Greeting | Hi! I'm the Acme assistant — happy to help with product or pricing questions. |
    | Theme    | Light                                                                         |
  </Step>

  <Step title="Save">
    The widget appears in the channel list.
  </Step>
</Steps>

## Step 7 — Test it

<Steps>
  <Step title="Click Test in the toolbar">
    A drawer opens on the right with a chat input.
  </Step>

  <Step title="Send a pricing question">
    > how much does Acme Pro cost?

    Wait a few seconds. The **Pricing Specialist** replies with the price (\$49/seat, 14-day trial) and offers volume discounts. Below the reply, the **debug** panel shows:

    ```
    [global] routeToActor → Triage — single top-level actor
    [branch] routeToChild → Pricing Specialist —
        User explicitly asks about the cost of Acme Pro,
        which is a pricing question. Route to Pricing Specialist.
    actor done() → The assistant provided a clear answer.
    ```

    Routing worked.
  </Step>

  <Step title="Send a follow-up question that switches topic">
    > actually, does it support SSO?

    Notice the routing trace this time. The flow's global router decides this is a cross-cutting product-capability question and replies directly using global context — a cleaner answer than handing off to Product Specialist for a one-line yes/no.

    <Frame>
      <img src="https://mintcdn.com/glorium/eqWkhSfBUec9afZU/images/conversation-flows/test-drawer-multi-actor.png?fit=max&auto=format&n=eqWkhSfBUec9afZU&q=85&s=5dabb89ee82e9654992af3ae13ff7392" alt="Multi-turn test session" width="1471" height="1225" data-path="images/conversation-flows/test-drawer-multi-actor.png" />
    </Frame>

    This is the routing layer adapting to the question. You don't write any of it — the activation prompts plus global context give the platform enough signal.
  </Step>
</Steps>

## Step 8 — Deploy

<Steps>
  <Step title="Close the test drawer">
    Click X. The test session is saved in Conversations history with a TEST badge.
  </Step>

  <Step title="Click Deploy">
    The status badge in the header changes from `draft` to `active`.
  </Step>

  <Step title="Embed the widget">
    Copy the embed snippet shown for the widget channel and paste it into your site's HTML before `</body>`:

    ```html theme={null}
    <script src="https://embed.cogniagent.ai/widget.js"
            data-flow-id="YOUR_FLOW_ID"
            async></script>
    ```

    The widget appears as a chat bubble. Real visitors can now talk to your flow.
  </Step>
</Steps>

## What you've built

* A flow with **global context** (Acme product blurb) inherited by every actor.
* Three actors, each with **focused instructions** and clear handoff rules.
* Two **routing edges** with activation prompts that drive the handoff decisions.
* A **widget channel** for inbound traffic on `acme.com`.
* A **deployed** flow that's live and answering real questions.

## Extending the flow

Things you could add next:

<CardGroup cols={2}>
  <Card title="Knowledge base" icon="database">
    Connect a product documentation KB to Product Specialist so it can cite specific feature docs.
  </Card>

  <Card title="Calendar integration" icon="calendar">
    Give Pricing Specialist a calendar integration so it can book an Enterprise quote call directly.
  </Card>

  <Card title="A Human Handoff actor" icon="user-headset">
    Add an actor that posts to your sales team's Slack channel for hard cases.
  </Card>

  <Card title="Email channel" icon="envelope">
    Add a Gmail channel so users can also reach the flow via email.
  </Card>
</CardGroup>

## Lessons from this build

<AccordionGroup>
  <Accordion title="Write Global Context once, not on every actor" icon="share-from-square">
    Both specialists *and* Triage share the Acme blurb. By putting it in Flow settings → Global Context, we wrote it once. Edits propagate immediately.
  </Accordion>

  <Accordion title="Activation prompts are plain language" icon="comments">
    No `intent = pricing` syntax. Just describe when the route should fire as if explaining to a teammate. The platform handles the matching.
  </Accordion>

  <Accordion title="Definitions of Done unlock handoffs" icon="check">
    Triage's DoD is "user's intent is clear and handed off". That tells the routing layer Triage is done as soon as it can identify the topic — keeping conversations from stalling.
  </Accordion>

  <Accordion title="The Test drawer is your debugger" icon="bug">
    Every routing decision is visible inline. When something misbehaves, the trace shows you where.
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="Capabilities" icon="puzzle-piece" href="/conversation-flows/build/capabilities">
    Give your actors knowledge bases and integration actions.
  </Card>

  <Card title="Channels overview" icon="share-nodes" href="/conversation-flows/channels/overview">
    Add more channels — email, Slack, phone, and more.
  </Card>
</CardGroup>
