arXiv:2604.02023cs.CRcs.AI2026-04

让自主代理用真实货币支付API调用,同时保障安全与预算控制。

APEX: Agent Payment Execution with Policy for Autonomous Agent API Access

  • 用HMAC签名短时令牌实现挑战-结算-消费流程,支持实时支付审批。
  • 政策管控使总支出降低27.3%,合法请求成功率仍达52.8%。
  • 适配印度UPI类法币系统,适合需合规支付的自动化场景。

自主代理正从简单检索转向执行API调用、编排工作流并实时决策的经济行为。随着这一趋势加速,API提供方亟需基于请求的付费机制与程序化支出管控。HTTP 402协议将支付作为首等协议事件,但多数实现依赖加密货币,与具备强实时法币系统(如印度UPI)的监管和基础设施现实不匹配。本文提出APEX——一个完整的研究系统,将类似HTTP 402的支付门控机制适配至UPI类法币流程,同时保留策略治理、令牌化访问验证与重放抵抗能力。系统采用挑战-结算-消费生命周期,结合HMAC签名的短时令牌、幂等结算处理及策略感知支付审批。基于FastAPI、SQLite与标准Python库构建,确保透明、可审计与可复现。在三个基线与六个场景中评估,样本量为初始实验的2-4倍(每场景N=20-40)。结果表明,策略执行使总支出减少27.3%,合法请求成功率维持在52.8%;安全机制对重放攻击与无效令牌实现100%拦截,平均延迟仅19.6ms。多次测试显示各场景方差低,95%置信区间内高度可复现。核心贡献在于构建了一个可控的代理-支付基础设施与参考架构,证明了代理访问商业化可在不牺牲安全与策略约束的前提下适配法币体系。

原文摘要 · Abstract (English)

Autonomous agents are moving beyond simple retrieval tasks to become economic actors that invoke APIs, sequence workflows, and make real-time decisions. As this shift accelerates, API providers need request-level monetization with programmatic spend governance. The HTTP 402 protocol addresses this by treating payment as a first-class protocol event, but most implementations rely on cryptocurrency rails. In many deployment contexts, especially countries with strong real-time fiat systems like UPI, this assumption is misaligned with regulatory and infrastructure realities. We present APEX, an implementation-complete research system that adapts HTTP 402-style payment gating to UPI-like fiat workflows while preserving policy-governed spend control, tokenized access verification, and replay resistance. We implement a challenge-settle-consume lifecycle with HMAC-signed short-lived tokens, idempotent settlement handling, and policy-aware payment approval. The system uses FastAPI, SQLite, and Python standard libraries, making it transparent, inspectable, and reproducible. We evaluate APEX across three baselines and six scenarios using sample sizes 2-4x larger than initial experiments (N=20-40 per scenario). Results show that policy enforcement reduces total spending by 27.3% while maintaining 52.8% success rate for legitimate requests. Security mechanisms achieve 100% block rate for both replay attacks and invalid tokens with low latency overhead (19.6ms average). Multiple trial runs show low variance across scenarios, demonstrating high reproducibility with 95% confidence intervals. The primary contribution is a controlled agent-payment infrastructure and reference architecture that demonstrates how agentic access monetization can be adapted to fiat systems without discarding security and policy guarantees.

自主代理支付系统法币支付安全机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。