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

# SLA monitoring

> Track response and resolution times against targets and flag at-risk tickets before they breach

SLA breaches damage customer trust and often trigger financial penalties in B2B contracts. The problem is not that teams ignore SLAs — it is that they only find out about a breach after it happens. By the time a manager notices a ticket has been open for 23 hours against a 24-hour SLA, there is almost no time to act. A proactive system that flags tickets approaching their deadlines gives your team the window they need to prevent breaches, not just report them.

This use case deploys a scheduled playbook that scans open tickets every hour, calculates time remaining against SLA targets, and alerts the team about tickets at risk of breaching. Python code handles the time calculations, accounting for business hours, weekends, and holidays. Tickets within 2 hours of their SLA deadline trigger an urgent Slack alert.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **Helpdesk system** — Open tickets with creation timestamps, first response timestamps, priority levels, and SLA policy assignments
    * **CRM system** — Customer contract details with SLA terms (response time, resolution time by priority)
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **SLA policy definitions** — Upload your SLA tiers with response and resolution targets by priority and customer tier
    * **Business hours calendar** — Upload your support team's working hours, holidays, and timezone rules
  </Card>
</CardGroup>

**Semantic layer:** Define these in your ontology before setting up the agent.

| Component | Name                | Definition                                                                                      |
| --------- | ------------------- | ----------------------------------------------------------------------------------------------- |
| Object    | Ticket              | Maps to the helpdesk ticket table. Represents an open support request with SLA timer data       |
| Object    | SLA Policy          | Maps to SLA configuration records. Defines response and resolution targets by priority and tier |
| Metric    | Time to SLA Breach  | Business hours remaining until the ticket's SLA deadline, calculated in real time               |
| Metric    | SLA Compliance Rate | Percentage of tickets resolved within their SLA target over a given period                      |
| Dimension | Priority            | Ticket priority: critical (1-hour response), high (4-hour), medium (8-hour), low (24-hour)      |
| Dimension | SLA Status          | Current SLA state: on track, at risk (less than 2 hours remaining), breached                    |

<Tip>
  See [building a semantic layer](/quickstart/build-semantic-layer) for a step-by-step guide.
</Tip>

***

## Agent setup

<Steps>
  <Step title="Create the agent">
    Go to **Agent Space** > **New agent**.

    | Field    | Value                                                                        |
    | -------- | ---------------------------------------------------------------------------- |
    | **Name** | SLA Monitor                                                                  |
    | **Role** | SLA compliance analyst                                                       |
    | **Goal** | Prevent SLA breaches by tracking deadlines and alerting the team proactively |
  </Step>

  <Step title="Set the description">
    > You monitor SLA compliance across all open tickets. When asked about SLA status, always show tickets closest to breaching first. Calculate time remaining in business hours, not calendar hours. For each at-risk ticket, show the ticket number, customer, priority, SLA target, time remaining, and assigned agent. If a ticket has already breached, note it clearly and recommend immediate action. Use precise timestamps and never round time remaining — 1 hour 42 minutes, not "about 2 hours."
  </Step>

  <Step title="Scope data access">
    Grant access to:

    * Helpdesk system data source (open tickets with timestamps)
    * CRM system data source (customer contracts with SLA terms)
    * SLA policy definitions knowledge space
    * Business hours calendar knowledge space
    * Ticket and SLA Policy objects in the semantic layer
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Check SLA status for open tickets">
        **Trigger:** User asks about SLA compliance or at-risk tickets

        1. Pull all open tickets with their creation timestamps, first response timestamps, and assigned SLA policies.
        2. Look up the SLA target for each ticket based on its priority and the customer's contract tier.
        3. Calculate elapsed business hours since ticket creation, accounting for business hours, weekends, and holidays.
        4. Compute time remaining until the SLA deadline for each ticket.
        5. Classify each ticket as on track, at risk (less than 2 hours remaining), or breached.
        6. Sort by time remaining, shortest first, and present a table with ticket number, customer, priority, SLA target, elapsed time, time remaining, and status.
      </Accordion>

      <Accordion title="Generate SLA compliance report">
        **Trigger:** User asks for an SLA compliance summary or performance report

        1. Pull all tickets closed in the specified period.
        2. Determine whether each ticket was resolved within its SLA target.
        3. Calculate the overall SLA compliance rate as a percentage.
        4. Break down compliance by priority level and customer tier.
        5. Identify the top three reasons for SLA breaches from resolution notes.
        6. Present a summary with compliance rate, breakdown table, and recommendations.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: Hourly SLA scan

<Steps>
  <Step title="Set the trigger">
    Schedule the playbook to run every hour during business hours (e.g., 8:00 AM to 8:00 PM on weekdays).
  </Step>

  <Step title="Build the workflow">
    The playbook scans all open tickets, calculates SLA time remaining, and alerts the team about at-risk tickets.

    1. **Query step** — Pull all open tickets with creation timestamps, priorities, and SLA policy assignments.
    2. **Python code step** — Calculate business hours elapsed and time remaining for each ticket. Account for the business hours calendar (working hours, weekends, holidays). Classify each ticket as on track, at risk, or breached.
    3. **Condition step** — Filter to tickets that are at risk (less than 2 hours remaining) or already breached.
    4. **Format step** — Build an alert message with ticket number, customer name, priority, time remaining, and assigned agent.

    <Info>
      The **Python code step** uses a Python code block to compute business-hours elapsed time, factoring in your working hours schedule, weekends, and holidays. You can customize the at-risk threshold (default 2 hours) and the business hours definition.
    </Info>
  </Step>

  <Step title="Configure delivery">
    Send at-risk ticket alerts to the #support-sla Slack channel. For breached tickets, also send a direct message to the assigned agent's manager with the ticket details and recommended action.
  </Step>

  <Step title="Test and activate">
    Click **Run now** to test with live data, then toggle to **Active**.
  </Step>
</Steps>

***

## What's next

<CardGroup cols={2}>
  <Card title="Email reply drafting" icon="arrow-right" href="/use-cases/customer-service/email-reply-drafting">
    Draft context-aware customer replies that match your brand voice.
  </Card>

  <Card title="All customer service use cases" icon="list" href="/use-cases/customer-service">
    See the full list.
  </Card>
</CardGroup>
