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 Rural Cooperative Inventory Pooling and Allocation Engine

Format
Code-aware
Lines
107
Sections
11
Linked challenge
Build a Rural Cooperative Inventory Pooling and Allocation Engine

Prompt source

Original prompt text with formatting preserved for inspection.

107 lines
11 sections
No variables
1 code block
## Build
Consolidate perishable agricultural inventory across smallholder farm cooperatives into unified Beckn catalog offerings. Allocate incoming bulk commercial purchase orders proportionally based on certified regional warehouse stocks.

## User
Agricultural cooperative logistics manager

## Workflow
1. Ingest decentralized stock manifests from regional cooperative nodes into a normalized inventory pool.
2. Publish pooled inventory availability using Beckn protocol discovery catalog item structures.
3. Parse incoming bulk order quotes and calculate fair allocation shares across contributing farm warehouses.
4. Generate split fulfillment work orders and simulated Beckn on_select responses for dispatch review.

## Interface
Cooperative operations screen showing participating warehouse quotas, pooled inventory levels, and order splits.

## Data
Construct synthetic cooperative warehouse stock listings and mock Beckn order JSON packets locally.
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 discovery, ordering, and fulfillment catalog structures for multi-provider inventory pooling.

## Tools
langgraph, pydantic, pytest.
LangGraph orchestrates the cyclic state transitions between inventory aggregation, stock allocation, and dispatch validation.
Local or hosted LLM with multi-step reasoning capabilities to resolve complex allocation edge cases.

## 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
- Aggregates multi-warehouse inventory without double-counting available stock.
- Splits incoming bulk orders proportionally across contributing warehouses with positive capacity.
- Rejects or truncates orders that exceed cumulative pooled availability.

## Starter Examples
```json
[
  {
    "input": {
      "order_request": {
        "item_id": "wheat_sharbati",
        "requested_quantity_kg": 500,
        "delivery_pincode": "462001"
      },
      "participating_coops": [
        {
          "coop_id": "coop_a",
          "available_kg": 300,
          "distance_km": 12
        },
        {
          "coop_id": "coop_b",
          "available_kg": 300,
          "distance_km": 25
        }
      ]
    },
    "expected_output": {
      "allocation_status": "FULFILLED",
      "allocated_total_kg": 500,
      "fulfillment_splits": [
        {
          "coop_id": "coop_a",
          "allocated_kg": 250
        },
        {
          "coop_id": "coop_b",
          "allocated_kg": 250
        }
      ],
      "unallocated_kg": 0
    }
  },
  {
    "input": {
      "order_request": {
        "item_id": "pulses_chana",
        "requested_quantity_kg": 1000,
        "delivery_pincode": "452001"
      },
      "participating_coops": [
        {
          "coop_id": "coop_c",
          "available_kg": 200,
          "distance_km": 10
        },
        {
          "coop_id": "coop_d",
          "available_kg": 300,
          "distance_km": 18
        }
      ]
    },
    "expected_output": {
      "allocation_status": "PARTIAL_SHORTAGE",
      "allocated_total_kg": 500,
      "fulfillment_splits": [
        {
          "coop_id": "coop_c",
          "allocated_kg": 200
        },
        {
          "coop_id": "coop_d",
          "allocated_kg": 300
        }
      ],
      "unallocated_kg": 500
    }
  }
]
```

## Safety
Inventory pooling and allocation calculations are simulated; no actual commercial contracts or physical logistics are committed.
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.