Proposal: sample agent — mandate-bounded spending authority (gate before irreversible payment)

Open
#742 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 7 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reviewing the existing Python agent samples in samples/python/agents/ and the A2A Python SDK patterns they use; then compare the proposed mandate semantics with the linked MMF-v0.1 spec. Done means a sample demonstrates deterministic allow, deny, and revocation decisions, with mock settlement and a hash-chained evidence log returned as a task artifact.

Written by the indexing model from the issue text.

Description

I'd like to propose a Python sample agent in samples/python/agents/, built on the A2A Python SDK like the other samples.

What it demonstrates

A shopping agent receives purchase tasks over A2A. Before any payment is attempted, every proposed transaction passes through a mandate gate: a principal grants the agent bounded spending authority (amount cap, payee allowlist, expiry, velocity limit, cumulative budget). The gate evaluates the proposal deterministically and the verdict drives the A2A task state:

  • ALLOW → task completes; the sample settles against a mock rail only — no real payment exists.
  • DENY → task fails with a machine-readable reason (payee not in allowed set, amount exceeds cap, mandate expired, velocity limit reached, cumulative budget exceeded).
  • REVOKED → demonstrates remote revocation: the principal revokes mid-session and the next attempt is denied at the gate.
  • Every decision — allowances and denials — is appended to a hash-chained evidence log returned as a task artifact, demonstrating tamper-evident auditability.

Why here

Existing samples cover tool use, streaming, and multi-agent flows; #735 proposes a verdict-based correctness check before payment. Neither covers the complementary question: is the agent authorized to spend at all? Agent-initiated payments (x402, agentic commerce) increasingly need a deterministic authorization layer between probabilistic agent intent and irreversible settlement — this sample demonstrates that pattern end-to-end on A2A task states.

The mandate semantics used are defined in an open spec (MMF-v0.1) with an Apache-2.0 reference implementation (mandata) — the sample would double as a second implementation surface for the pattern. Related research framing: survey of agentic-payment safeguards.

Disclosure: I maintain the Mandata library and authored the linked survey. Happy to adjust scope — a self-contained version with no external dependency is equally fine.

Dominant language
Jupyter Notebook
Stars
1.8k
Forks
777
Avg merge
9d 18h
Merged PRs (30d)
21

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from a2aproject/a2a-samples

All issues in a2aproject/a2a-samples

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.