Skip to main content
Loading navigation
Back to prompt library

Build a Delegated Voice Agent Consent Envelope and Action Auditor — implementation

Linked challenge: Build a Delegated Voice Agent Consent Envelope and Action Auditor

Prompt source

implementation117 lines11 sectionsNo variables1 code block
## Build
Audit voice assistant commerce transaction transcripts against machine-readable consent envelopes. Detect prompt injection, unauthorized order confirmations, and budget exceedances before dispatching Beckn network order calls.

## User
Consumer digital rights advocate

## Workflow
1. Parse audio-transcribed user utterances and extract intended commerce intents, item quantities, and spend limits.
2. Compare extracted purchase intentions against user-defined consent receipts specifying allowable autonomous actions.
3. Identify discrepancies such as unintended cross-selling items or unconfirmed high-value items.
4. Compile an auditable transaction approval or denial slip with explanatory violation tags for user review.

## Interface
Voice transcript reviewer displaying conversational turns, detected intent slots, consent boundaries, and verdict.

## Data
Synthesize realistic vernacular-to-English voice commerce transcripts with deliberate edge-case policy violations.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
Uses Beckn protocol transaction ordering stages (discovery, ordering quote agreement, confirmation) to define consent scopes.

## Tools
mastra-ai, pydantic, pytest.
Mastra AI provides transparent agent workflow coordination and verifiable step logging for auditability.
Instruction-tuned model with strict intent classification and parameter extraction capabilities.

## 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
- Detects discrepancies between spoken quantity and cart items prepared by the delegated voice agent.
- Blocks transactions when extracted order total exceeds the pre-authorized single-transaction budget limit.
- Produces structured audit envelopes containing validation results for human user sign-off.

## Starter Examples
```json
[
  {
    "input": {
      "user_consent_policy": {
        "max_order_inr": 2000,
        "allowed_actions": [
          "reorder_essentials",
          "confirm_cart"
        ],
        "require_explicit_voice_ack": true
      },
      "session_transcript": [
        {
          "speaker": "user",
          "text": "Please reorder 5kg basmati rice from local kirana."
        },
        {
          "speaker": "agent",
          "text": "Total is 650 rupees. Shall I place the order?"
        },
        {
          "speaker": "user",
          "text": "Yes, please go ahead."
        }
      ],
      "agent_proposed_order": {
        "total_inr": 650,
        "items": [
          {
            "name": "basmati rice 5kg",
            "amount": 650
          }
        ]
      }
    },
    "expected_output": {
      "verdict": "PERMITTED",
      "reasons": [
        "Action within spending cap",
        "Explicit confirmation observed"
      ],
      "dispatched_action": "order_confirmed"
    }
  },
  {
    "input": {
      "user_consent_policy": {
        "max_order_inr": 1000,
        "allowed_actions": [
          "reorder_essentials"
        ],
        "require_explicit_voice_ack": true
      },
      "session_transcript": [
        {
          "speaker": "user",
          "text": "Show me latest smart watches on discount."
        },
        {
          "speaker": "agent",
          "text": "Found a watch for 3500 rupees. Placing order now automatically."
        }
      ],
      "agent_proposed_order": {
        "total_inr": 3500,
        "items": [
          {
            "name": "smart watch",
            "amount": 3500
          }
        ]
      }
    },
    "expected_output": {
      "verdict": "HALTED_VIOLATION",
      "reasons": [
        "Order total 3500 INR exceeds maximum permitted 1000 INR",
        "Category not permitted under reorder_essentials scope",
        "Missing explicit user voice confirmation acknowledgment"
      ],
      "dispatched_action": "none"
    }
  }
]
```

## Safety
Inspects simulated voice commerce logs only; does not place live orders or access real payment gateways.
Use mock external writes. Require human review before any real deployment.