> ## 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.

# Shift performance reporting

> Generate automated OEE reports at the end of every shift with downtime breakdowns

Shift supervisors need accurate performance data the moment a shift ends, not the next morning after someone manually pulls numbers from three different systems. Delays in reporting mean delays in corrective action — a line running at 60% OEE for an entire second shift because nobody caught the first shift's downtime event.

This use case connects your production database to a Wayak agent that answers shift performance questions on demand and a playbook that automatically generates an OEE report at every shift change. The playbook uses Python to calculate OEE components and compare them against targets.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **Production database** — Output logs (units produced, units scrapped per line per shift), downtime event records with cause codes and durations
    * **ERP system** — Production schedule with planned output targets per line
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **OEE reference guide** — Upload your OEE calculation methodology and target definitions
    * **Downtime cause code manual** — Standard cause codes and their categories (planned, unplanned, changeover)
  </Card>
</CardGroup>

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

| Component | Name            | Definition                                                                                 |
| --------- | --------------- | ------------------------------------------------------------------------------------------ |
| Object    | Production Run  | Maps to the production output log. Represents a single line's output during one shift      |
| Object    | Downtime Event  | Maps to the downtime records table. Represents one stoppage with cause, duration, and line |
| Metric    | OEE             | Availability x Performance x Quality, expressed as a percentage per line per shift         |
| Metric    | Scrap Rate      | Units scrapped divided by total units produced, as a percentage                            |
| Dimension | Shift           | Categorizes data by shift period (Day, Swing, Night)                                       |
| Dimension | Production Line | Groups data by physical production line identifier                                         |

<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** | Shift Performance Analyst                                     |
    | **Role** | Production performance analyst                                |
    | **Goal** | Provide real-time shift performance insights and OEE analysis |
  </Step>

  <Step title="Set the description">
    > You are a production performance analyst. When asked about shift performance, always start with the OEE number and whether it met the target. Break OEE into its three components (availability, performance, quality) so the user can see which factor drove the result. List downtime events in order of duration, longest first. Use precise numbers and avoid vague language like "approximately." If a line underperformed its target, recommend checking the longest downtime event first.
  </Step>

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

    * Production database data source (output logs and downtime records)
    * ERP system data source (production schedule and targets)
    * OEE reference guide knowledge space
    * Production Run and Downtime Event objects in the semantic layer
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Generate shift performance summary">
        **Trigger:** End of shift or user asks about shift performance

        1. Pull production output for the specified shift, including units produced and units scrapped for each line.
        2. Retrieve the planned output target for each line from the production schedule.
        3. Calculate OEE for each line: availability multiplied by performance multiplied by quality.
        4. Compare each line's actual OEE against its target OEE.
        5. List any unplanned downtime events with duration, cause code, and affected line.
        6. Summarize in a table: line, target OEE, actual OEE, units produced, scrap count, and top downtime cause.
      </Accordion>

      <Accordion title="Analyze downtime trends">
        **Trigger:** User asks about downtime patterns or recurring issues

        1. Pull downtime events for the specified time range, defaulting to the last 7 days.
        2. Group events by cause code and calculate total minutes lost per cause.
        3. Rank cause codes by total downtime, highest first.
        4. Identify any cause code that appeared on more than two consecutive shifts.
        5. Present a ranked table with cause code, occurrence count, total minutes, and affected lines.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: End-of-shift OEE report

<Steps>
  <Step title="Set the trigger">
    Schedule the playbook to run three times daily at shift change times: 6:00 AM, 2:00 PM, and 10:00 PM.
  </Step>

  <Step title="Build the workflow">
    The playbook pulls the last 8 hours of production data, calculates OEE for every line, and delivers a formatted report.

    1. **Query step** — Pull all production output records and downtime events for the shift that just ended.
    2. **Python code step** — Calculate OEE components for each line using the standard formula.
    3. **Condition step** — Flag any line where OEE fell below the target threshold.
    4. **Format step** — Build the report with a summary table and a downtime breakdown section.

    <Info>
      The **Python code step** uses a Python code block to compute availability (run time / planned production time), performance (actual output / theoretical output), and quality (good units / total units). It multiplies the three to produce OEE. You can customize target thresholds per line.
    </Info>
  </Step>

  <Step title="Configure delivery">
    Send the report via email to the shift supervisor and plant manager. For any line below target, also send a Slack message to the #production-alerts channel.
  </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="Quality defect analysis" icon="arrow-right" href="/use-cases/manufacturing/quality-defect-analysis">
    Identify defect patterns across lines, shifts, and operators to reduce scrap.
  </Card>

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