Inspiration
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for PayAgentic: ADK Escrow Engine
💡 Inspiration
Today’s most effective coding agents depend on cloud-hosted LLMs with massive recurring token costs. However, a major technological inflection is taking place: developers and enterprises are transitioning toward running autonomous coding agents locally on consumer-grade hardware using open-weight foundation models, Google ADK specifications, and specialized PEFT/LoRA adapters.
Yet, a fundamental economic barrier stalls this movement:
- The Buyer Risk: How can an engineer safely buy fine-tuned LoRA weights or ADK bundles without risking funds on broken safetensors, missing runtime configs, or non-functional skill scripts?
- The Seller Vulnerability: How can autonomous AI sales agents negotiate volume seat licenses without falling prey to adversarial prompt injection exploits that force discount rates below operating costs?
We built PayAgentic: ADK Escrow Engine to establish true autonomous agentic commerce by bridging dynamic LLM-driven negotiation with deterministic policy verification and two-phase conditional payment escrow through PayPal's enterprise infrastructure.
⚙️ What It Does
PayAgentic is an end-to-end autonomous escrow marketplace and execution engine for local coding agents:
- Autonomous License Negotiation: An AI sales broker negotiates per-seat tiers and custom bundles with developers in natural dialogue while dynamically calculating hardware-compatible configurations.
- Deterministic Policy Guardrails: A deterministic rule engine isolates financial decisions from LLM reasoning. Even under sophisticated prompt injection attacks, the system enforces hard minimum floor prices ($P_{\text{floor}}$) where: $$P_{\text{settled}} \ge P_{\text{base}} \times (1 - \text{Discount}_{\max})$$
- Conditional Escrow Settlement (PayPal Authorize & Capture): Rather than standard immediate captures, PayAgentic creates orders using PayPal Orders API v2 with
intent="AUTHORIZE"to lock funds safely in escrow. - Automated Sandbox Package Audit: While customer funds remain held, an automated headless validator inspects the uploaded ADK archive (
submission.zip):- Validates the existence and syntax of the root
agent.yaml. - Verifies PEFT LoRA
safetensorsheaders andadapter_config.json. - Audits all ADK skill scripts against malicious directory traversal (
../) and external sandbox escapes.
- Validates the existence and syntax of the root
- Cryptographic Release via Webhook Verification: Upon cryptographically verifying PayPal Webhook signatures (
/v1/notifications/verify-webhook-signature), the engine invokes the PayPal Capture API and releases an ephemeral AES-256 decryption key to unlock the payload for the buyer. - Financial Observability via AG Grid: A unified Alpine-Dark dashboard gives marketplace administrators real-time visibility into active negotiations, realized margins, security passes, and webhook event logs.
🛠️ How We Built It
- Backend & API Layer: Engineered in Python 3.12 with FastAPI to manage asynchronous negotiation sessions, headless package inspections, and high-throughput PayPal webhook listeners.
- Autonomous Intelligence: Powered by Google Gemini API with native Function Calling / Tool Use to invoke pricing calculators, structural verification, and transaction pipelines deterministically.
- Payment Infrastructure: Integrated with PayPal Developer Platform (Sandbox) using:
- Orders API v2 with Two-Phase Commit (
AUTHORIZEthenCAPTURE). - Webhooks API with full asymmetric digital signature verification.
- Orders API v2 with Two-Phase Commit (
- Deterministic Verification & Cryptography: Implemented with
pydanticv2,pyyaml, andcryptography(AES-256 Fernet) to ensure zero unauthorized asset leakage before verified capture. - Observability Dashboard: Designed with AG Grid Enterprise/Community, customized with custom cell renderers, floating filters, and live transaction pooling.
- Cloud Infrastructure: Configured with a
render.yamlBlueprint for single-click deployment on Render PaaS with automated health checks (/healthz).
🚧 Challenges We Ran Into
- Decoupling AI Reasoning from Financial Enforcement: LLMs are non-deterministic by design. To prevent pricing exploits, we had to enforce an out-of-band validation barrier that intercepts function calls and rejects transactions if they breach pricing rules, completely taking financial authorization out of the model's subjective judgment.
- Asynchronous Webhook Signature Validation: Validating PayPal's transmission signatures required reconstructing transmission headers (
transmission_id,cert_url,auth_algo, and raw body CRC32) precisely to pass PayPal's cryptographic verification endpoint. - Safe Inspection of Untrusted ADK Bundles: Inspecting zip archives containing arbitrary user scripts required structural static analysis to detect path traversal attempts before loading any files.
🏆 Accomplishments That We're Proud Of
- True Closed-Loop Agentic Commerce: Built a complete, autonomous software commerce lifecycle where the agent negotiates, holds escrow, audits the code package, captures payment, and decrypts the license without human intervention.
- Zero-Trust Pricing Architecture: Hardened against prompt injection attacks through deterministic Pydantic schemas.
- Deep PayPal API Integration: Went beyond basic button redirects by implementing complete Authorize/Capture flows and automated webhook verifications.
- Comprehensive Operator Dashboard: A responsive, dark-mode AG Grid interface that provides complete transparency into algorithmic decisions and transaction lifecycles.
📚 What We Learned
- Language models belong in the negotiation and contextual interaction layer; financial boundaries, asset validation, and settlement triggers must remain strictly deterministic.
- PayPal's two-phase
AUTHORIZEandCAPTUREarchitecture provides an optimal foundation for autonomous agent-to-agent and agent-to-human escrow commerce.
🔮 What's Next for PayAgentic
- Automated SWE-Bench Dry-Runs: Running an ephemeral Docker container to evaluate the coding agent's patch pass-rate on SWE-bench Lite issues before capturing escrow funds.
- Multi-Party Revenue Splits: Utilizing PayPal Payouts API to automatically distribute royalties between model fine-tuners, ADK skill authors, and compute providers.