Inspiration
Returns and replacements can be frustrating when customers have to navigate complicated processes, understand eligibility rules, and figure out what happens after submitting a request. I wanted to explore how AI could make this experience more conversational while keeping important decisions secure and under the user's control.
That idea led to ReturnPilot, an AI-powered returns and replacement assistant built around a simple principle: AI should help users navigate a process, but consequential actions must remain governed by deterministic backend rules and explicit user approval.
What it does
ReturnPilot allows users to interact with a synthetic order dataset through a conversational interface. Users can look up orders, inspect order details, check return or replacement eligibility, and review a proposed action before deciding whether to approve or decline it.
When a user explicitly approves an eligible proposal, the backend verifies the approval and creates a persistent request. Users can then view their request history and status.
The application also records important workflow events, making the process more transparent and traceable.
How I built it
I built the frontend using React, Vite, and JavaScript, with Python, FastAPI, and Pydantic powering the backend. Google Gemini handles natural-language interactions and selects from a restricted set of read and eligibility-checking tools.
I integrated a Python MCP server using Streamable HTTP with a corresponding backend MCP client. MCP provides the tool interface, while shared Python domain services enforce the business rules.
I used PostgreSQL to persist orders, proposals, approvals, requests, sessions, and audit events, with SQLAlchemy for database access and Alembic for schema migrations.
One of my key design decisions was to keep consequential actions outside the language model's control. Creating a proposal does not create a request. Only explicit approval handled by the backend can initiate request creation, supported by signed, short-lived approval authorization and transactional database safeguards.
Challenges I faced
One of my main challenges was separating conversational AI from business logic. Language models can interpret user requests, but they should not determine authorization or bypass eligibility checks.
I addressed this by combining AI-assisted conversations with deterministic backend validation, explicit approval, ownership checks, and persistent state.
Another challenge was integrating MCP into a complete application workflow rather than using it as a standalone demonstration. I implemented a Python MCP client and server over Streamable HTTP and connected them to shared domain services.
I also designed safeguards for duplicate approvals and uncertain outcomes, using persisted records to support idempotent request creation and reconciliation.
What I learned
Building ReturnPilot helped me understand how to integrate an LLM with a conventional backend, implement an MCP-based tool interface, manage persistent workflows, and establish approval boundaries around AI-assisted actions.
I learned that a useful AI application needs more than a good conversation. It also needs reliable state management, clear authorization rules, validation, and recovery mechanisms for uncertain operations.
What's next
I would like to expand ReturnPilot with more workflow scenarios, stronger operational monitoring, broader evaluation of conversational inputs, and a more comprehensive end-to-end demonstration.
Current scope: ReturnPilot uses synthetic demonstration data. It does not connect to real Amazon accounts or process real returns, refunds, replacements, shipping labels, or shipments.
Built With
- alembic
- fastapi
- gemini
- javascript
- mcp
- postgresql
- pydantic
- pytest
- python
- react
- sqlalchemy
- vite
Log in or sign up for Devpost to join the conversation.