DEV Community

Cover image for Building MerchantPilot AI with QwenCloud: An Autopilot Agent for Fintech Merchant Onboarding
Angel Afube
Angel Afube

Posted on

Building MerchantPilot AI with QwenCloud: An Autopilot Agent for Fintech Merchant Onboarding

Ideation

When I came across the Hackathon, I thought of a pain point in the fintech industry where I work, and then my mind flew to compliance. Merchant onboarding can be slow because even after business details are collected, the review team has to critically review each document, inspect identity or business registration evidence, assess risk, recommend compliance actions, and maintain an audit trail for every decision.

This is why, for the Qwen Cloud Global AI Hackathon, I decided to build MerchantPilot AI, an autonomous merchant operations platform for fintech onboarding teams. I shared the idea with a colleague, @odunayo_dada, and he was immediately on board. With the excitement of the hackathon, he created the repository right away, and we got to work. MerchantPilot AI explores how AI can be integrated into a compliance-sensitive workflow without losing transparency. The goal is not to let AI blindly approve merchants, but to enable AI to prepare an explainable decision package, allowing a human reviewer to move faster with better context and a complete audit trail.

The core features of MerchantPilot AI

Built with QwenCloud as the intelligence layer, MerchantPilot AI demonstrates how an autopilot agent can support merchants' onboarding workflows from document intake to human review. Its features include:

  • Merchant onboarding form for collecting key business information
  • Document upload support for merchant verification documents
  • AI-assisted review generation for risk and compliance analysis
  • Explainable recommendations rather than opaque approvals
  • Human review actions such as approve, reject, or request more information
  • Audit logging for operational traceability
  • A dashboard and review center for monitoring open applications

These features are designed around the idea that AI should help teams move faster while still preserving accountability and trust.

Why the human-in-the-loop design matters

human review page

One of the strongest aspects of MerchantPilot AI is its emphasis on human control. The system does not claim that AI alone should make final compliance decisions. Instead, it prepares a decision package that makes the review more efficient and more consistent.

That approach is especially important in fintech, where regulatory and operational sensitivity requires both transparency and oversight. By logging each agent event and storing structured risk/compliance outputs, the system gives reviewers a foundation for decision-making that is auditable and explainable.

Technology Stack

The project uses a modern full-stack architecture that is well-suited for building AI-enabled web applications.

Merchant
    │
    ▼
Next.js Frontend
    │
    ▼
FastAPI Backend
    │
 ┌──┴─────────────┐
 │                │
 ▼                ▼
PostgreSQL    QwenCloud
 │                │
 └──────┬─────────┘
        ▼
AI Review Package
        │
        ▼
Human Reviewer
Enter fullscreen mode Exit fullscreen mode
  • A Next.js frontend provides the merchant dashboard, application form, and review center. The frontend is built with Next.js, Tailwind CSS, and TypeScript, providing a polished and responsive user experience.

  • A FastAPI backend handles merchant creation, document upload, review orchestration, and persistence. The backend is built with FastAPI and Python, making it easy to expose APIs and integrate with AI services.

  • A PostgreSQL database stores merchant records, documents, audit logs, risk assessments, and agent activity. The data layer uses PostgreSQL with SQLAlchemy and Alembic for persistence and migrations. The application also includes a storage abstraction layer, allowing it to support local development storage and future cloud storage integrations.

  • A Qwen-based service powers the AI review flow by generating structured outputs for risk, compliance, and agent event timelines. Qwen Cloud is integrated through the backend service layer, where it powers structured merchant review generation.

The deployment stack is also designed to be container-friendly:

services:
  backend:
    build: ./backend
    ports:
      - "8000:8000"

  frontend:
    build: ./frontend
    ports:
      - "3000:3000"

  postgres:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
Enter fullscreen mode Exit fullscreen mode

The project is intentionally structured like a production scaffold, even though it is a hackathon build. Its modular structure makes the system easy to understand and extend. It also reflects a common modern architecture: UI, API, service layer, and database working together to deliver a coherent product experience.

QwenCloud

In MerchantPilot AI, Qwen Cloud is responsible for turning any merchant application into an actionable review output. I chose QwenCloud because it provided a straightforward API for integrating LLM capabilities into our backend while supporting structured responses needed for compliance workflows.

In the project, QwenCloud is abstracted behind a dedicated service:

backend/app/services/agents/qwen_service.py
Enter fullscreen mode Exit fullscreen mode

The backend sends structured merchant context to Qwen, including:

  • Merchant profile data
  • Uploaded document metadata
  • Required document expectations
  • Demo-mode CAC verification output
  • A strict JSON schema describing the review package the system needs back

Qwen then returns a structured response containing:

  • Risk score
  • Risk level
  • Confidence
  • Recommendation
  • Supporting reasons
  • Compliance requirements
  • Compliance gaps
  • Memory records
  • Agent timeline events

That response is validated with Pydantic before it is persisted. If Qwen returns invalid JSON or a shape that does not match the expected schema, the backend rejects it and asks the user to retry the review.

agent timeline screen

The Agent Design

MerchantPilot AI is organized around specialized agents that represent different parts of a compliance operation:

  • Intake Agent checks submitted data and document completeness.
  • Verification Agent inspects document evidence and CAC signals.
  • Risk Agent evaluates risk level, score, reasons, and confidence.
  • Compliance Agent maps findings to compliance requirements and gaps.
  • Memory Agent records durable review context for future operations.
  • Human Review keeps a person in the loop for final decisions.

This structure made the product feel more realistic than a single "AI says yes or no" button. Each agent contributes a piece of the operational picture, and the timeline shows how the review evolved.

Challenges Faced

Building this project came with several practical challenges. One of the biggest challenges was ensuring that the AI output was structured and consistent enough to be used by the application. Since the system relies on model-generated JSON, it needed validation and fallback handling to protect the backend from malformed responses.

There were also infrastructure concerns, including how to manage document storage, persistence, and the connection between the frontend, backend, and AI service.

The service layer also handles errors carefully. An example is seen below:

except QwenAuthenticationError as exc:
    raise HTTPException(status_code=401, detail=str(exc)) from exc
except QwenResponseValidationError as exc:
    raise HTTPException(status_code=502, detail="Qwen returned an invalid review.") from exc
Enter fullscreen mode Exit fullscreen mode

This makes the application more resilient and gives the user a clear error path when the AI service fails.

What I Would Add Next

If I were to expand this project beyond the current demo version, I would move from mock verification to real-world regulatory and document verification sources. Another enhancement would be to add more advanced agents for fraud detection, sanctions screening, or document authenticity analysis.

The system could also be expanded with:

  • more sophisticated approval workflows
  • role-based access for compliance reviewers
  • multi-language support for global merchant onboarding
  • integration with external KYC and AML services
  • a more advanced memory layer for reusable merchant patterns
  • production-grade observability and monitoring

In other words, the current version is an excellent foundation for a much richer autonomous operations platform.

What I Learned Building with QwenCloud

The biggest lesson was that agentic products need more than a good model call. The model is powerful, but the surrounding system matters just as much:

  • The input context must be structured.
  • The output must be validated.
  • Failure cases need clear logs.
  • Human reviewers need a usable interface.
  • Auditability has to be built into the workflow, not added later.

QwenCloud turned out to be a great fit for this project. Its OpenAI-compatible API made integration straightforward, and it was able to generate structured review packages from realistic merchant onboarding scenarios with very little friction.

Closing Thoughts

MerchantPilot AI is my attempt to build a realistic AI autopilot for merchant operations; a system that makes compliance teams faster, more consistent, and more auditable.

This project reminded me that AI doesn't have to replace experts to create value. In regulated industries like fintech, the biggest opportunity is helping people make faster, better-informed decisions. MerchantPilot AI is my exploration of what that future could look like, and I'm excited to continue refining it beyond the hackathon.

Github Repo: https://github.com/AfubeAngel/MerchantPilotAI
Live Link: http://47.84.224.187:3000/review

Top comments (0)