PayPal AgentOps: The Control Plane for Trusted Agentic Commerce
Inspiration
AI agents are becoming increasingly capable of recommending products, making purchasing decisions and interacting with payment platforms. However, an AI-generated recommendation should never automatically become permission to spend money.
What happens when an AI agent recommends a purchase that exceeds a buyer's budget? Who approves the transaction? How can we trace the decisions made by the AI, the policy engine and the buyer?
These questions inspired PayPal AgentOps, a proof of concept demonstrating how AI-assisted commerce can operate within defined spending policies, explicit human approval checkpoints and auditable payment workflows.
Our guiding principle is simple:
AI proposes. Policy decides. Humans approve. PayPal Sandbox creates the checkout order.
What it does
PayPal AgentOps is an AI-powered commerce governance dashboard that demonstrates how buyers can maintain control over AI-generated purchasing recommendations.
The application provides six core capabilities:
- AI-powered purchase proposals: Google Gemini converts natural-language shopping requests into structured purchase proposals.
- Deterministic policy enforcement: A Python policy engine validates spending limits and approved merchant categories before a purchase can proceed.
- Human-in-the-loop approval: Eligible proposals require explicit simulated buyer approval or rejection.
- PayPal Sandbox integration: Following approval and a separate confirmation, the application creates a checkout order using PayPal Orders v2.
- Audit trail: Timestamped events record proposal creation, policy decisions, buyer actions and PayPal Order IDs.
- Interactive dashboard: A Streamlit interface allows users to manage proposals, approvals, sandbox orders and audit records.
For example, a £49.99 office supplies purchase with a £100 spending limit can proceed to buyer review if its category is approved. A £150 proposal against the same limit is automatically blocked.
Importantly, creating a PayPal sandbox order does not mean a payment has been completed. The application does not authorize, capture or transfer funds.
How we built it
We developed PayPal AgentOps using a modular Python architecture that separates AI-generated recommendations from policy decisions and payment-platform operations.
Technology stack:
- Python 3.12: Core application and business logic.
- Streamlit: Interactive dashboard and workflow interface.
- Google Gemini API: AI-generated structured purchase proposals.
- Python policy engine: Deterministic spending and merchant-category enforcement.
- PayPal Sandbox REST API: OAuth2 authentication, Orders v2 order creation and order-status lookup.
- unittest: Automated policy testing.
- GitHub Actions: Continuous integration.
- Streamlit Community Cloud: Public application hosting.
End-to-end workflow
- The buyer submits a shopping request.
- Gemini generates a structured purchase proposal.
- The application validates the proposal fields.
- The policy engine checks the amount and merchant category.
- Non-compliant proposals are blocked.
- Compliant proposals enter a pending-approval state.
- The buyer explicitly approves or rejects the proposal through the demonstration interface.
- Following simulated approval, a separate confirmation initiates PayPal sandbox order creation.
- PayPal returns an Order ID and order status.
- The application records the relevant events in its audit trail, which can be exported as JSON.
This separation ensures that AI-generated purchase intent does not independently authorize a payment-platform operation.
Challenges we faced
1. Separating AI recommendations from spending authority
Generative AI is probabilistic, whereas financial policies require predictable enforcement. We addressed this by keeping spending limits and merchant-category validation in a deterministic Python policy engine.
2. Designing meaningful human approval
We needed to demonstrate a workflow where policy approval and buyer approval are separate decisions. The application therefore requires explicit simulated buyer review and a further confirmation before creating a PayPal sandbox order.
3. Integrating PayPal safely
We integrated PayPal Sandbox OAuth2 and Orders v2 while clearly distinguishing order creation from payment authorization or capture.
4. Making decisions traceable
We implemented UTC-timestamped audit events connecting proposals, policy outcomes, simulated buyer decisions and PayPal Order IDs.
Accomplishments that we're proud of
- Built and deployed a working AI-assisted commerce governance prototype.
- Integrated Google Gemini with PayPal Sandbox through a controlled workflow.
- Implemented deterministic spending and category policies.
- Demonstrated blocked, approved and rejected purchase scenarios.
- Added an auditable event history with JSON export.
- Published the project with an open-source MIT License and automated tests.
What we learned
The most important lesson was that AI capability and financial authority must be separated.
AI can generate useful purchasing recommendations without being granted unrestricted spending permissions.
We also learned the importance of explicit approval checkpoints, deterministic business rules and traceable events when designing trustworthy agentic commerce systems.
What's next for PayPal AgentOps
Our next development priorities include:
- Persistent, tamper-evident audit storage.
- Authenticated buyer identity and authorization.
- Real-time transaction monitoring and automated alerts.
- Risk scoring and anomaly detection.
- Enterprise policy administration and approval workflows.
- More comprehensive transaction reconciliation and operational observability.
Our long-term vision is to develop PayPal AgentOps into a governance and observability control plane for trusted AI-assisted commerce.
Current limitations
PayPal AgentOps is a hackathon proof of concept operating in PayPal Sandbox.
Buyer approvals are simulated rather than identity-verified. Audit events are stored in Streamlit session state rather than a persistent database. The application does not process real payments, capture funds or implement continuous real-time monitoring.
Project links
Live application: https://paypal-agentops-hackathon-eksknbyjh7w4vc8cjb9yiy.streamlit.app/
GitHub repository: https://github.com/Cloud-Architect-Emma/paypal-agentops-hackathon
YouTube demonstration: https://youtu.be/7R_1syBF8hc
Architecture documentation: https://github.com/Cloud-Architect-Emma/paypal-agentops-hackathon/blob/main/docs/ARCHITECTURE.md