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

# Last-mile visibility

> Consolidate tracking data from multiple carriers into a single view and keep customers informed proactively

Last-mile delivery is where customer satisfaction is won or lost. But when you use multiple carriers, tracking data is scattered across different portals and APIs with inconsistent formats and update frequencies. Your customer service team spends their time logging into carrier websites instead of solving problems, and customers get no updates until they call in.

Wayak consolidates tracking data from all your carriers into a single, normalized view. An agent answers "where is my shipment" questions in real time, and a playbook pushes proactive notifications to customers when status changes or delays occur — before they have to ask.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **TMS database** — Shipment records with order ID, carrier, tracking number, origin, destination, and committed delivery date
    * **Carrier tracking APIs** — Real-time tracking events from all carriers (FedEx, UPS, USPS, regional carriers, LTL providers)
    * **Customer database** — Customer contact information, notification preferences, and order history
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **Carrier status code mappings** — Translation tables that map each carrier's proprietary status codes to a normalized set (in transit, out for delivery, delivered, exception)
    * **Customer communication templates** — Approved notification templates for shipping confirmation, out-for-delivery, delivered, and delay alerts
  </Card>
</CardGroup>

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

| Component | Name             | Definition                                                                                                        |
| --------- | ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| Object    | `Shipment`       | Maps to the TMS shipments table. Represents a delivery in progress with its normalized tracking status            |
| Object    | `TrackingEvent`  | Maps to the consolidated tracking events table. Represents a single status update with timestamp and location     |
| Metric    | `ETAAccuracy`    | Percentage of shipments where the actual delivery time fell within the committed delivery window                  |
| Dimension | `DeliveryStatus` | Normalized categorization: label created, picked up, in transit, out for delivery, delivered, exception, returned |

<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** | Shipment Tracker                                                         |
    | **Role** | Shipment visibility and exception specialist                             |
    | **Goal** | Keep stakeholders informed and catch delays before they impact customers |
  </Step>

  <Step title="Set the description">
    > You track shipments across carriers and provide real-time status updates. When someone asks "where is my shipment," respond with the normalized status, current location, and estimated delivery time — not raw carrier codes. For delays, include the cause, the revised ETA, and what is being done about it. Use a factual, calm tone. Proactively mention if other shipments on the same order are also affected. Always provide the tracking number and carrier name for reference.
  </Step>

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

    * TMS database (shipments, tracking numbers, order IDs)
    * All carrier tracking APIs
    * Customer database (contact information, preferences)
    * Carrier status code mappings knowledge space
    * Customer communication templates knowledge space
    * `Shipment`, `TrackingEvent` objects and `ETAAccuracy` metric
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Look up shipment status">
        **Trigger:** User asks about a shipment, tracking number, or order

        1. Identify the shipment from the provided tracking number, order ID, or customer name.
        2. Query the carrier tracking API for the full event history.
        3. Normalize the carrier status codes to the standard set (label created, picked up, in transit, out for delivery, delivered, exception, returned).
        4. Determine the current status and location.
        5. If in transit, estimate the remaining delivery time based on the current location and the carrier's typical transit speed for this lane.
        6. Present the status summary: current status, location, ETA, and a timeline of key events.
      </Accordion>

      <Accordion title="Proactive delay notification">
        **Trigger:** Tracking event indicates a delay or exception

        1. Detect the delay from the carrier tracking event (missed scan, exception code, or ETA pushed past the committed date).
        2. Classify the delay type: carrier delay, weather, address issue, customs hold, or capacity shortage.
        3. Estimate the revised ETA based on the delay type and historical resolution times.
        4. Retrieve the customer's notification preferences from the customer database.
        5. Draft a notification using the approved delay template, including the revised ETA and a reference number.
        6. Send via the customer's preferred channel (email or SMS).
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: Proactive delivery status updates

<Steps>
  <Step title="Set the trigger">
    Schedule: **Every 2 hours from 6:00 AM to 10:00 PM** to catch status changes throughout the delivery day.
  </Step>

  <Step title="Build the workflow">
    1. **Query** the TMS for all shipments currently in transit or out for delivery.
    2. **Loop** through each shipment:
       * Query the carrier tracking API for the latest event.
       * Compare the latest event against the last known status in the consolidated tracking table.
       * If the status has changed, update the consolidated table and check if a customer notification is warranted.
    3. **Condition:** If the new status is "delivered," send a delivery confirmation. If the new status is "exception" or the ETA has slipped past the committed date, send a delay alert.
    4. **Aggregate** a summary of all status changes for the operations team: total deliveries confirmed, total delays detected, and total notifications sent.
  </Step>

  <Step title="Configure delivery">
    Customer notifications go via the customer's preferred channel (email or SMS). The operations summary goes to the `#last-mile-ops` Slack channel. If delay notifications exceed 10% of active shipments, send an escalation email to the logistics director.
  </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="Delivery exception management" icon="arrow-right" href="/use-cases/logistics/delivery-exception-management">
    Go deeper on exception handling with root cause analysis and structured escalation workflows.
  </Card>

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