Skip to main content
Back to Prompt Library
implementation

Build the application

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build a Public Traffic Camera Assisted Port Corridor Delivery Router

Format
Code-aware
Lines
78
Sections
11
Linked challenge
Build a Public Traffic Camera Assisted Port Corridor Delivery Router

Prompt source

Original prompt text with formatting preserved for inspection.

78 lines
11 sections
No variables
1 code block
## Build
Ingest Singapore Expressway camera feeds and traffic incident alerts to route port deliveries. Rebalance hauler itineraries to avoid West Coast Highway bottlenecks.

## User
Intermodal Transport Coordinator

## Workflow
1. Query public traffic camera image metadata and expressway incidents via data.gov.sg endpoints.
2. Extract congestion severity scores along critical arteries connecting Tuas Port to Jurong industrial estates.
3. Calculate detour routing penalties and carbon emission trade-offs for heavy container trucks.
4. Generate route advisories and updated estimated delivery windows for terminal dispatchers.

## Interface
Interactive corridor map highlighting camera snapshots, computed congestion indices, and alternative transit routes.

## Data
Simulated JSON snapshots mirroring the data.gov.sg real-time Traffic Images API schema for Ayer Rajah Expressway (AYE).
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore open data API](https://guide.data.gov.sg/developer-guide/api-overview)
Consumes the data.gov.sg real-time Traffic Images and expressway speed band API structure to assess port road corridor congestion.

## Tools
crewai, python, pydantic.
crewAI coordinates separate agent roles for traffic ingestion, routing calculation, and fleet notification.
Instruction-tuned LLM via API for translating visual congestion metrics into concrete transport rerouting notices.

## 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
- Parse camera image timestamps and congestion indicators from simulated traffic API responses.
- Trigger detour routing when primary corridor travel speeds drop below 20 km/h.
- Compute comparative fuel and time deltas for the Tuas Megaport corridor.
- Produce driver dispatch manifests with turn-by-turn bypass recommendations.

## Starter Examples
```json
[
  {
    "input": {
      "dispatch_id": "DISP-CORR-101",
      "origin": "Jurong Logistics Hub",
      "destination": "Tuas Port Phase 1",
      "assigned_route": "AYE_WESTBOUND",
      "traffic_data": {
        "corridor": "AYE (towards Tuas)",
        "average_speed_kmh": 14.2,
        "incident_reported": "Breakdown before Benoi exit",
        "camera_id": "4701"
      }
    },
    "expected_output": {
      "reroute_recommended": true,
      "selected_bypass": "JURONG_PORT_ROAD_TO_PIONEER_ROAD",
      "estimated_time_saved_mins": 28,
      "emission_delta_kg_co2": 4.2,
      "dispatch_notice": "AYE congested at 14 km/h due to breakdown. Haulers directed via Pioneer Road bypass to meet Tuas gate slot."
    }
  },
  {
    "input": {
      "dispatch_id": "DISP-CORR-102",
      "origin": "Pasir Panjang Hub",
      "destination": "Tuas Port Phase 1",
      "assigned_route": "AYE_WESTBOUND",
      "traffic_data": {
        "corridor": "AYE (towards Tuas)",
        "average_speed_kmh": 68,
        "incident_reported": "None",
        "camera_id": "4701"
      }
    },
    "expected_output": {
      "reroute_recommended": false,
      "selected_bypass": null,
      "estimated_time_saved_mins": 0,
      "emission_delta_kg_co2": 0,
      "dispatch_notice": "Traffic flow smooth on AYE (68 km/h). Maintain primary corridor transit."
    }
  }
]
```

## Safety
All routes generated are navigational recommendations; drivers must follow official road signage and traffic regulations.
Use mock external writes. Require human review before any real deployment.

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.