Skip to main content
Loading navigation
Back to prompt library

Build a Mock Logistics Service Coordination and Status Engine — implementation

Linked challenge: Build a Mock Logistics Service Coordination and Status Engine

Prompt source

implementation72 lines11 sectionsNo variables1 code block
## Build
Simulate and coordinate multi-hop delivery handoffs across independent Beckn network logistics providers. Monitor status updates, track transit milestones, and generate exception alerts.

## User
Intermodal Logistics Controller

## Workflow
1. Ingest mock Beckn on_init quotes for multi-segment parcel transport.
2. Simulate parcel handoffs between first-mile, line-haul, and last-mile service providers.
3. Receive and validate asynchronous Beckn on_status callback packets.
4. Identify transit delays and generate rerouting advice for stalled consignments.

## Interface
Multi-hop consignment map tracking package custody, segment SLAs, and exception alerts.

## Data
Generate synthetic Beckn on_status callback fixtures representing varying multi-hop delivery states.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
Adopts Beckn Protocol Core transaction lifecycle and fulfillment status tracking specifications.

## Tools
mastra-ai, fastapi, pydantic.
Coordinates complex workflow steps and schedules delayed state transitions for multi-hop tracking.
Fast local or hosted model capable of parsing state machine transitions.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Validates asynchronous on_status packets against Beckn message schemas.
- Maintains accurate custody state across multi-segment provider handoffs.
- Detects SLA breach events and flags unacknowledged callbacks.
- Exports unified tracking timelines for downstream buyer platform integration.

## Starter Examples
```json
[
  {
    "input": {
      "consign_id": "PKG-301",
      "current_segment": "LINE_HAUL",
      "provider_id": "BPP-FREIGHT-12",
      "event": {
        "status": "REACHED_HUB",
        "hub_code": "HUB-DEL-02",
        "timestamp": "2026-04-12T14:00:00Z"
      }
    },
    "expected_output": {
      "consignment_status": "IN_TRANSIT",
      "next_provider": "BPP-LASTMILE-04",
      "sla_breached": false,
      "next_action": "TRIGGER_LAST_MILE_PICKUP"
    }
  },
  {
    "input": {
      "consign_id": "PKG-302",
      "current_segment": "FIRST_MILE",
      "provider_id": "BPP-LOCAL-01",
      "event": {
        "status": "PICKUP_FAILED",
        "reason": "MERCHANT_STORE_CLOSED",
        "timestamp": "2026-04-12T19:30:00Z"
      }
    },
    "expected_output": {
      "consignment_status": "EXCEPTION_RAISED",
      "next_provider": null,
      "sla_breached": true,
      "next_action": "RESCHEDULE_FIRST_MILE_MORNING"
    }
  }
]
```

## Safety
Coordinates simulated parcel identifiers and mock logistics hubs; no real transport resources are dispatched.
Use mock external writes. Require human review before any real deployment.