Inspiration

Payment failures and refund incidents often require multiple steps: investigating the transaction, checking customer history, assessing risk, reviewing policies, and deciding what action is safe. I wanted to explore how an AI agent could coordinate this workflow without giving an LLM unrestricted control over financial operations.

What it does

PayPilot is an autonomous payment recovery and risk agent built around PayPal Sandbox. It investigates payment incidents, gathers relevant evidence, assesses risk, and proposes actions such as refunds.

Its Gemini-powered planning layer generates structured plans. A tool registry and deterministic policy gate validate proposed actions before execution. Sensitive actions can require human approval, keeping financial operations controlled and auditable.

How I built it

I built the backend using Python and FastAPI, integrated the Google Gemini API for agent planning, and connected PayPal Sandbox for payment operations. I also developed a dashboard to inspect incidents, evidence, proposed actions, policy decisions, and audit logs.

The system separates AI reasoning from action execution: Gemini proposes what should happen, while deterministic application logic checks whether it is permitted.

Challenges and learnings

One of the biggest challenges was designing an agent that could reason about incidents without allowing unpredictable model output to directly control payment operations. I addressed this with structured tool calls, validation, policy checks, and human approval.

I learned how to integrate an LLM into a tool-using agent, work with payment APIs, design policy-based safeguards, and maintain an auditable workflow. I also encountered intermittent model API availability issues, reinforcing the importance of handling failures safely.

Built With

Share this project:

Updates

Submission history