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

# How Duckie Works

> Understanding the flow from message to response

This page explains what happens when a customer message arrives and how Duckie processes it to generate a response.

## The Message Flow

When a customer sends a message, Duckie follows an intelligent workflow:

## Step-by-Step Breakdown

### 1. Receive & Route

When a message arrives from a connected channel (Zendesk, Slack, Intercom, etc.):

1. **Webhook handler** receives the event from the external platform
2. **Signature verification** ensures the request is authentic
3. **Deployment matching** finds which agent should handle this message
4. **Run record** is created to track the execution

<Info>
  Each message creates a "run" — a complete record of how Duckie handled the conversation, including all reasoning and tool calls.
</Info>

### 2. Check Guardrails

Before processing, Duckie evaluates safety constraints:

* **Restrictions** are checked first (highest priority)
* **Escalation rules** are evaluated against the conversation context
* If a guardrail triggers, the conversation may be escalated to a human

### 3. Execute the Agent

The agent follows its configured start mode:

* **Autonomous agents** decide which resources and tools to use
* **Workflow agents** follow a visual workflow
* **Runbook agents** follow a selected runbook
* **Knowledge search** retrieves relevant information
* **Tool calls** perform actions (query external systems, update records, etc.)
* **Context gathering** builds understanding of the customer's situation

### 4. Generate Response

Using all gathered context:

* **Guidelines** shape the tone, format, and content
* **Response generation** creates a draft reply
* **Validation** ensures the response doesn't violate any guardrails

### 5. Deliver & Classify

Finally:

* **Response delivery** sends the message back through the source channel
* **Classification** assigns categories and attributes
* **Resolution evaluation** determines if the issue is resolved

## Visibility & Transparency

Every step is logged and visible in the Duckie dashboard:

* **Run history** shows all executions
* **Step details** reveal reasoning and tool calls
* **Timeline view** shows the full conversation flow

<Card title="View Run History" icon="clock-rotate-left" href="/analytics/runs">
  Learn how to analyze agent execution
</Card>

## Deployment Modes

How responses are delivered depends on the deployment mode:

| Mode        | Behavior                                            |
| ----------- | --------------------------------------------------- |
| **Live**    | Agent responds directly to customers                |
| **Testing** | Agent runs with testing options before live traffic |

<Card title="Learn about Deployment Modes" icon="toggle-on" href="/deployments/deployment-modes">
  Choose the right mode for your use case
</Card>

## Next Steps

<CardGroup cols={2}>
  <Card title="Create an Agent" icon="robot" href="/agents/creating-agents">
    Build your first agent
  </Card>

  <Card title="Set Up Guardrails" icon="shield" href="/guardrails/overview">
    Configure safety constraints
  </Card>

  <Card title="Deploy to a Channel" icon="rocket" href="/deployments/overview">
    Connect agents to customers
  </Card>

  <Card title="Monitor Performance" icon="chart-line" href="/analytics/overview">
    Track and improve results
  </Card>
</CardGroup>
