Skip to content

examples: add Agent Payment Guard HTTP service#144

Merged
safal207 merged 1 commit into
mainfrom
codex/github-mention-add-http-agent-payment-guard-service-with-st
May 26, 2026
Merged

examples: add Agent Payment Guard HTTP service#144
safal207 merged 1 commit into
mainfrom
codex/github-mention-add-http-agent-payment-guard-service-with-st

Conversation

@safal207
Copy link
Copy Markdown
Owner

Motivation

  • Expose the existing Agent Payment Guard as a local HTTP authorization boundary that external AI agents/adapters can call before execution.
  • Reuse existing guard decision and audit logic to avoid duplicating core rules while providing a simple service surface for testing and integration.

Description

  • Add examples/agent-payment-guard/payment_guard_service.py implementing a small ThreadingHTTPServer with endpoints GET /v1/health, POST /v1/payment-proposals/evaluate, and GET /v1/audit/records that reuse decide, append_audit, and get_previous_hash from payment_guard.py.
  • Implement enforce and shadow mode semantics and return execution_allowed, would_block, and audit_hash in evaluation responses.
  • Read and return recent audit records from .proofpath/audit.jsonl with a bounded limit query parameter.
  • Add examples/agent-payment-guard/run_service_check.sh to exercise the service end-to-end (health, enforce + shadow evaluation, audit retrieval, and hash-chain verification).
  • Add docs/agent-payment-guard-service.md with startup instructions and copy-pasteable curl examples.

Testing

  • Ran bash examples/agent-payment-guard/run_demo_check.sh and it passed (demonstrates CLI demo still works).
  • Ran bash examples/agent-payment-guard/run_service_check.sh and it passed (service health, enforce/shadow semantics, audit endpoint, and audit_hash checks succeeded).
  • Ran python3 scripts/verify_audit_log.py .proofpath/audit.jsonl and it passed (audit hash-chain verification succeeded).

Codex Task

@safal207 safal207 merged commit 81d2ca1 into main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant