AgentPal — The Bank Account for AI Agents, With a Human Co-Signer

Inspiration

AI agents can browse stores, compare prices, manage subscriptions, and pay freelancers. But one major challenge remains: how can we trust an AI agent with money?

Giving AI direct access to a credit card introduces risks. Agents can make mistakes, overspend, fall for fraudulent listings, or execute transactions without proper authorization.

I built AgentPal to solve that problem.

AgentPal gives AI agents controlled spending allowances without exposing payment credentials. Agents propose transactions, deterministic security rules evaluate them, humans approve the exact terms, and PayPal verifies the outcome.

The AI proposes. Rules decide. You approve. PayPal verifies.

What It Does

AgentPal is an open-source AI financial control platform that connects AI agents to secure payment workflows.

Each agent receives a unique identity, scoped permissions, and a spending allowance rather than direct access to a payment card.

Core Features

Agent Wallets: Monthly budgets, transaction limits, wallet freezing, and per-agent permissions.

Payment Approvals: Human authorization cryptographically bound to exact transaction terms.

AI Shopping Assistant: Discovers products and proposes purchases within budget.

Market Intelligence: Compares proposed purchases with retailer offers.

Smart Counter-Offers: Allows owners to replace expensive requests with better deals.

Saver Agents: Automatically identify savings opportunities and retire if they generate no verified savings during a month.

Test Lab: Demonstrates attacks involving overspending, split purchases, altered terms, and swapped payees.

PayPal Integration: Sandbox payments, captures, refunds, payouts, and reconciliation.

Financial Audit Trail: Tracks requests, decisions, approvals, and verified outcomes.

Developer Integrations: MCP server, REST API, Python SDK, OpenAPI, and Postman.

How It Works

An AI agent identifies a purchase and submits a payment request.

AgentPal checks spending limits, permissions, merchant restrictions, and suspicious transaction patterns before the request reaches the owner.

Channel3 checks market offers, while Kernel can inspect the merchant's product page. The dashboard presents these findings as advisory evidence.

The owner can approve, reject, or counter with better terms.

Approval is cryptographically bound to the exact agent, amount, currency, merchant, payee, and purpose. Any change invalidates the approval.

Once approved, the transaction proceeds through PayPal sandbox. AgentPal recognizes completion only after an authenticated PayPal read or a verified webhook.

Uncertain outcomes are reconciled rather than assumed successful.

How the Sponsor Tools Are Integrated

PayPal — Payment Infrastructure

PayPal powers AgentPal's sandbox payment workflow.

Integration:

Orders v2 for creating and capturing approved payments.

Exact-terms verification through authenticated order reads.

Signed webhook verification.

Full and partial refunds.

Freelancer payments through Payouts.

Dispute visibility and Transaction Search reconciliation.

Verified: Sandbox captures, partial refunds, payouts, signed webhooks, and end-to-end payment execution.

Documentation: docs/PAYPAL_SANDBOX.md, docs/PAYPAL_REFUNDS.md, docs/PAYPAL_PAYOUTS.md, docs/PAYPAL_OPERATIONS.md.

Channel3 — Market Intelligence

Channel3 provides product discovery and market-based purchase analysis.

Integration:

Compares requested prices against retailer offers.

Identifies overpriced products, unusually low prices, unavailable products, and merchant mismatches.

Supplies alternatives for counter-offers.

Powers AI Shopper product discovery.

Provides recorded offers for Saver agents.

Verified: Identified a Belkin charger at B&H Photo for $15.99 against a $24.99 request, enabling a $9.00 cheaper replacement.

Documentation: docs/CHANNEL3_INTEGRATION.md.

Kernel — Cloud Browser Verification

Kernel allows AgentPal to inspect merchant pages before payment.

Integration:

Opens merchant pages in a hosted browser.

Captures displayed products, prices, stock information, and redirect destinations.

Records screenshot evidence.

Flags discrepancies between a request and the merchant's page.

Browser content is treated as untrusted evidence and cannot authorize transactions.

Verified: Hosted cloud-browser page checks.

Documentation: docs/KERNEL_INTEGRATION.md, docs/KERNEL_BROWSER.md.

Render — Cloud Infrastructure

Render hosts AgentPal's dashboard and FastAPI backend.

Integration:

Persistent disk for the SQLite ledger.

Environment variables for credentials.

Automated deployments.

Hosted Saver agent execution every 15 minutes while running.

Live application: https://agentpal-api.onrender.com/app/

Documentation: docs/DEPLOYMENT.md.

Postman — API Documentation and Testing

Postman supports API exploration and security validation.

Integration:

Generated /v1 API collection.

OpenAPI synchronization checks.

Newman security tests.

Optional remote workspace synchronization.

Verified: 17 requests, 34 assertions, and zero failures.

Code: postman/v1.collection.json.

APIMatic — API Accuracy and SDK Validation

APIMatic helped validate PayPal integration accuracy and developer tooling.

Integration:

PayPal Context Plugin.

Pinned CLI validation pipeline.

OpenAPI and response-contract checks.

SDK smoke tests against a running AgentPal process.

Verified: Local SDK smoke tests and contract checks. Hosted SDK generation requires credentials.

Code: apimatic/, docs/APIMATIC_INTEGRATION.md, docs/SDK.md.

AG Grid and AG Charts — Dashboard

AG Grid Community powers interactive approval, transaction, and agent tables.

AG Charts provides spending and approval visualizations.

Features include filtering, sorting, CSV export, mobile layouts, and locally vendored libraries operating under a restrictive Content-Security-Policy.

Groq and OpenRouter — AI Models

Groq's gpt-oss-120b powers the AI Shopper and agent companies.

OpenRouter free models provide fallback capability.

All model outputs remain advisory. AI cannot override spending rules or independently approve transactions.

How I Built It

AgentPal uses Python 3.13, FastAPI, SQLite, and a versioned REST API, deployed on Render.

The system also includes an asynchronous Python SDK, an MCP server, an OpenAPI specification, a generated Postman collection, and a responsive JavaScript dashboard.

Financial reservations and shared spending limits use atomic database transactions to prevent concurrent overspending. Idempotency keys protect repeated requests.

The dashboard uses AG Grid and AG Charts, with strict browser security policies and locally hosted assets.

I also created AI agent teams to demonstrate real workflows:

Northstar Digital: A marketing agency with Atlas, Forge, Muse, and Ledger.

Lumen Cloud: A SaaS company with Orbit, Pulse, and Keel.

AI Shopper: Product discovery and purchase proposals.

Saver Agents: Automated savings recommendations.

These agents operate within permissions and allowances. None can approve transactions, capture payments, issue refunds, or change payees.

Developer & Engineering — How I Developed AgentPal

My Role as Developer

I served as the project creator, architect, and developer, taking responsibility for the concept, system design, payment-control architecture, security requirements, integration decisions, testing, and deployment.

Rather than treating AI as an unrestricted programmer, I used AI coding assistants as a collaborative engineering team while retaining responsibility for the design and acceptance of changes.

AI-Assisted Development Workflow

I used multiple AI development tools with different responsibilities:

Claude Code: Lead development assistance, architecture implementation, and code review.

OpenAI Codex: Implementation, debugging, and engineering tasks.

Fable: Product strategy and development of the counter-offer concept.

Kimi K3: Additional technical review.

APIMatic PayPal Context Plugin: Guidance grounded in PayPal API definitions.

Each change was reviewed, and security boundaries were supported by regression tests.

Backend Architecture

The backend is implemented in Python 3.13 using FastAPI.

Its major components include:

Identity and permissions: Owner authentication, agent API keys, scoped capabilities, and workspace isolation.

Financial ledger: Tracks committed spending, pending reservations, refunds, and payment activity.

Policy engine: Applies budgets, transaction limits, rolling spending windows, and merchant restrictions.

Approval engine: Binds authorization to an exact SHA-256 fingerprint of transaction terms.

Payment services: Integrates PayPal Orders, Refunds, Payouts, Disputes, and reconciliation.

Market intelligence services: Uses Channel3 offers and Kernel browser evidence.

AI services: Connects Groq and OpenRouter to agent workflows.

Audit services: Records financial decisions and verified events.

Available spending capacity is calculated as:

Available allowance = Monthly budget − Committed spending − Pending reservations

The allowance is reserved when a request is created, committed only when PayPal confirms the payment, and released when a request is rejected, countered, or expires.

Atomic database transactions prevent concurrent requests from committing more allowance than the available budget.

Developer API and MCP Integration

AgentPal is designed to be integrated into other AI systems.

Developers can use its:

Versioned /v1 REST API.

Asynchronous Python SDK.

OpenAPI specification.

Generated Postman collection.

MCP server compatible with clients such as Claude Desktop, Claude Code, and Cursor.

The MCP server deliberately exposes only five agent capabilities: read wallet, request payment, read request, list requests, and execute an approved payment.

It does not expose approval, capture, refund, or payee-modification tools.

This is an architectural security decision: an agent cannot invoke a privileged operation that does not exist in its interface.

Security Engineering

Security was designed into AgentPal's transaction lifecycle.

Key safeguards include:

SHA-256 fingerprints binding approvals to exact transaction terms.

Hashed agent API keys and owner authentication tokens.

Encrypted provider credentials.

Scoped agent capabilities.

Transaction limits and shared budget enforcement.

Rolling-window split-purchase detection.

Atomic database transactions.

Idempotent payment requests.

Verified PayPal outcomes.

Merchant domain checks.

Untrusted browser-content handling.

Optional TOTP protection for approvals.

Workspace isolation.

A request cannot bypass a failed deterministic spending rule through an AI recommendation or browser result.

Testing and Quality Assurance

I used a test-first approach for new security boundaries and regression fixes.

The repository contains more than 4,100 automated tests, covering:

Financial integrity.

API behavior.

Authentication and authorization.

Workspace isolation.

Payment verification.

Concurrent requests.

Split-purchase prevention.

Approval modification attempts.

Browser security.

Mobile and desktop dashboard behavior.

The Test Lab also allows users and judges to demonstrate four important security scenarios directly through the dashboard.

CI validation and targeted security reviews were part of the development process.

Open-Source Development

AgentPal is published under the MIT license, allowing developers to inspect, modify, and integrate its code.

To run it locally:

git clone https://github.com/muhammadbilalbajwa156/agentpal.git cd agentpal python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt python -m agentpal start

Developers can then configure a workspace and connect supported provider credentials through the dashboard.

Challenges I Ran Into

Trustworthy payment confirmation: A browser redirect does not prove that a payment was completed. AgentPal uses authenticated PayPal reads or verified webhooks.

Webhook certificate verification: A new DigiCert intermediate in PayPal's sandbox certificate chain required a corrected verification path and regression tests.

Concurrent financial operations: Shared budgets and counter-offers exposed race conditions, resolved through atomic database operations.

Prompt injection: Merchant pages can contain malicious instructions. Their contents are treated as untrusted data.

Preventing split purchases: Rolling merchant spending windows identify attempts to bypass transaction limits.

AI reliability: Malformed model outputs and provider limits required fallback support and deterministic validation.

Strict browser security: AG Grid and AG Charts required careful configuration to function under a restrictive Content-Security-Policy.

Accomplishments

Built a working end-to-end PayPal sandbox payment system.

Implemented cryptographic approval fingerprints.

Integrated Channel3 market intelligence and Kernel browser verification.

Demonstrated a $9.00 saving through a counter-offer.

Created Saver agents and simulated AI companies.

Built four interactive Test Lab security demonstrations.

Implemented refunds, payouts, reconciliation, and financial audit trails.

Completed more than 4,100 automated tests.

Published an open-source MIT-licensed repository.

Provided developer access through REST, Python SDK, MCP, and Postman.

What I Learned

AgentPal taught me that the hardest part of AI-powered payments is not transferring money, but proving who authorized a transaction, what was authorized, and whether the payment actually occurred.

I learned that deterministic policies must remain independent of AI reasoning, and that removing dangerous permissions is stronger than attempting to constrain them.

I also discovered that allowing users to negotiate a better offer makes financial safety more useful than a simple approve-or-reject interface.

What's Next

Future development includes:

Production PayPal support following a full security review.

Merchant-specific budgets and category spending limits.

Mobile and chat-based payment approvals.

Remote MCP connectivity.

Outbound webhooks.

Two-person approval for high-value transactions.

Further autonomous shopper capabilities.

The long-term vision is to make AgentPal a trusted financial permission layer for autonomous AI agents.

Project Links

Live Demo: https://agentpal-api.onrender.com/app/

GitHub Repository: https://github.com/muhammadbilalbajwa156/agentpal

License: MIT

Current Environment: PayPal Sandbox

AgentPal currently uses sandbox test money. No real-money transactions or retailer purchases are executed, and the platform is not a production banking service.

Built With

Share this project:

Updates

Submission history