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 Delegated Procurement Consent Receipt and Audit Verifier

Format
Code-aware
Lines
120
Sections
11
Linked challenge
Build a Delegated Procurement Consent Receipt and Audit Verifier

Prompt source

Original prompt text with formatting preserved for inspection.

120 lines
11 sections
No variables
1 code block
## Build
Inspect automated agent transaction attempts against user consent receipts formatted with Beckn protocol context headers. Verify permission boundaries, cumulative budget limits, and category scopes to prevent unauthorized procurement actions.

## User
Enterprise procurement auditor

## Workflow
1. Ingest incoming transaction callback payloads and extract Beckn protocol context fields including action, timestamp, and message parameters.
2. Compare requested transaction amounts and domain categories against the active cryptographic consent receipt parameters.
3. Detect permission overreaches such as expired timestamps, unauthorized seller IDs, or breached spend caps.
4. Output a tamper-evident audit disposition report approving or blocking the delegated transaction for human compliance sign-off.

## Interface
Browser-based compliance dashboard showing side-by-side consent limits, agent execution traces, and audit logs.

## Data
Generate synthetic JSON fixtures conforming to Beckn protocol context and message formats with simulated delegation receipts.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
Applies Beckn protocol context and message packet structures (context fields like action, timestamp, domain) for verifying delegated transactions.

## Tools
pydantic-ai, fastapi, pytest.
Pydantic AI enforces type-safe schema validation on transaction contexts and structured consent audit decisions.
Fast reasoning API or local 8B parameter instruction model capable of structured JSON output.

## 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
- Rejects transactions when requested amount exceeds consent receipt spending cap.
- Rejects actions when transaction timestamp exceeds consent validity horizon.
- Emits compliant Beckn protocol ACK or NACK context structures for all simulated callbacks.

## Starter Examples
```json
[
  {
    "input": {
      "consent_receipt": {
        "receipt_id": "cr_101",
        "user_id": "usr_99",
        "max_amount_inr": 5000,
        "valid_until": "2025-12-31T23:59:59Z",
        "allowed_categories": [
          "agriculture",
          "seeds"
        ]
      },
      "transaction_packet": {
        "context": {
          "domain": "agriculture",
          "action": "confirm",
          "timestamp": "2025-06-15T10:00:00Z",
          "bap_id": "buyer-app.mock",
          "bpp_id": "coop-seller.mock"
        },
        "message": {
          "order": {
            "id": "ord_552",
            "item_category": "seeds",
            "quote": {
              "price": {
                "value": 3400,
                "currency": "INR"
              }
            }
          }
        }
      }
    },
    "expected_output": {
      "disposition": "APPROVED",
      "receipt_id": "cr_101",
      "violations": [],
      "ack_status": "ACK"
    }
  },
  {
    "input": {
      "consent_receipt": {
        "receipt_id": "cr_102",
        "user_id": "usr_77",
        "max_amount_inr": 1500,
        "valid_until": "2025-01-01T00:00:00Z",
        "allowed_categories": [
          "groceries"
        ]
      },
      "transaction_packet": {
        "context": {
          "domain": "electronics",
          "action": "confirm",
          "timestamp": "2025-06-15T10:00:00Z",
          "bap_id": "buyer-app.mock",
          "bpp_id": "tech-seller.mock"
        },
        "message": {
          "order": {
            "id": "ord_881",
            "item_category": "electronics",
            "quote": {
              "price": {
                "value": 2400,
                "currency": "INR"
              }
            }
          }
        }
      }
    },
    "expected_output": {
      "disposition": "BLOCKED",
      "receipt_id": "cr_102",
      "violations": [
        "Category 'electronics' not permitted in consent receipt",
        "Amount 2400 INR exceeds maximum authorized 1500 INR",
        "Transaction timestamp is past receipt validity"
      ],
      "ack_status": "NACK"
    }
  }
]
```

## Safety
Simulates financial consent evaluations only; no real payments, bank credentials, or government IDs are handled.
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.