Inspiration

Insurance claims processing is notoriously slow, manual, and prone to human error. As an autodidact and tech enthusiast passionate about building complete AI solutions, I wanted to tackle a complex, document-heavy B2B workflow. The inspiration came from seeing how businesses struggle with repetitive triage tasks. I set out to build an intelligent autopilot agent that not only extracts data but makes autonomous, risk-based decisions. Leveraging Alibaba Cloud's powerful DashScope (Qwen) and OSS, I aimed to transform a weeks-long manual process into a seamless, seconds-long automated pipeline.

What it does

Claimflow Autopilot is a B2B agent for autonomous insurance claims processing. It ingests raw claim submissions (such as email text or uploaded documents), uses an LLM to extract structured data, and routes each claim through an automated decision pipeline. The system computes a normalized risk score (0.0 to 1.0), auto-approves low-risk claims instantly, and securely escalates high-risk claims to human adjusters for review. It acts as an end-to-end triage, risk assessment, and routing system.

How we built it

I built Claimflow using a modern, robust Python stack. The backend is powered by FastAPI for high-performance REST endpoints. The core intelligence is driven by a LangGraph agent pipeline that manages the state and flow of each claim through distinct nodes: triage, risk_assessment, human_review, and approval. For the AI capabilities, I integrated Alibaba Cloud DashScope (Qwen) to handle complex natural language understanding and structured data extraction. All claim documents and raw inputs are securely stored using Alibaba Cloud OSS. I also utilized Pydantic for strict data validation and structured the project with automated testing (pytest) and linting (ruff) to ensure code quality.

Challenges we ran into

One of the main challenges was designing a resilient state machine for the LangGraph agent that could handle unstructured, messy real-world claim data without breaking the pipeline. Ensuring the Qwen model accurately extracted structured fields from free-text emails and correctly computed a normalized risk score required careful prompt engineering and schema validation. Another challenge was seamlessly integrating the asynchronous nature of FastAPI with the LangGraph execution flow while managing secure, scalable document uploads to Alibaba Cloud OSS. Accomplishments that we're proud of I am incredibly proud of successfully orchestrating a multi-node LangGraph pipeline that accurately mimics real-world business logic. Integrating Alibaba Cloud DashScope to achieve highly accurate data extraction and risk scoring from unstructured text is a major highlight. Furthermore, building a fully production-ready FastAPI application with automated testing, linting, and a clean architecture from the ground up gives me great confidence in the system's reliability and scalability.

What we learned

I deepened my understanding of how to build agentic workflows using LangGraph and how to effectively prompt Qwen models for structured data extraction and complex reasoning. I learned a lot about Alibaba Cloud's ecosystem, particularly how to efficiently manage object storage (OSS) for document-heavy applications. It also reinforced the importance of designing resilient error-handling and state management in autonomous AI pipelines.

What's next for Claimflow

Next, I plan to add support for multimodal inputs, allowing the system to process images of physical documents or damage assessments using Qwen's vision capabilities. I also want to implement a more advanced RAG (Retrieval-Augmented Generation) pipeline to cross-reference claims with specific insurance policy documents stored in OSS. Finally, I aim to deploy the application on Alibaba Cloud's serverless infrastructure for global scalability and add a real-time monitoring dashboard.

Built With

  • agents
  • alibaba
  • api
  • automation
  • autonomous
  • b2b
  • cloud
  • dashscope
  • data
  • extraction
  • fastapi
  • insurtech
  • langgraph
  • llm
  • machine
  • oss
  • pydantic
  • pytest
  • python
  • qwen
  • rest
  • risk
  • ruff
  • state
  • uvicorn
Share this project:

Updates

posted an update

From Zero to Production-Grade AI Autopilot in 10 Days: Building Claimflow on Qwen Cloud:

The Challenge On July 5th, 2026, I stared at a blank repository and a bold deadline: 10 days to build a production-ready AI autopilot agent for the Global AI Hackathon Series with Qwen Cloud — Track 4. The problem I chose to tackle? Insurance claims fraud detection — an $80 billion annual problem where manual processes are slow, inconsistent, and easily gamed. The goal: build a system that could read a customer's claim, analyze their uploaded photo, verify real-world weather data, cross-validate everything, and make an intelligent routing decision — all with human oversight at critical checkpoints. Today, July 15th, Claimflow is live, tested, and submitted. Here's how it happened.

Day 1-2: Architecture First, Code Second I've learned from past hackathons (including building TerraPilot) that jumping straight into code creates technical debt you can't repay in a sprint. So I started with the architecture. The core insight: Fraud detection isn't a single AI call — it's an orchestrated pipeline where each step informs the next. I designed a 6-node LangGraph state machine: Triage → Investigation → Risk Assessment → Human Review / Auto-Approve / Reject ↓ ↓ Vision Analysis Weather Verification

Each node has a single responsibility: Triage Node: Extract structured data from messy customer text using Qwen-Max with Pydantic-enforced Structured Output (zero hallucination) Vision Node: Analyze uploaded photos with Qwen-VL to detect damage type and severity Investigation Node: Call external tools (Open-Meteo Historical Weather API) to fact-check claims against real-world data Risk Assessment Node: Cross-validate text ↔ image ↔ weather and calculate a fraud risk score Human Review Node: Route high-risk claims to human analysts with full evidence Auto-Approve Node: Fast-track legitimate claims with matching evidence Key design decision: Fail-Closed Security. If any verification step fails, the system NEVER auto-approves. It always escalates to human review. In insurance, a false positive (unnecessary review) is infinitely better than a false negative (paying a fraudulent claim). Day 3-4: The Qwen Cloud Integration The heart of Claimflow is Alibaba Cloud's Qwen models, accessed through the DashScope API. Why Qwen? Three capabilities made the difference: Structured Output with qwen-max: Instead of parsing JSON from free-form text (fragile, error-prone), I forced the model to return Pydantic objects directly. The model either conforms to the schema or the library retries. Zero parsing errors in 103+ tests. Multimodal reasoning with qwen-vl-max: The agent doesn't just read — it SEES. When a customer claims "my kitchen caught fire" but uploads a photo of a water leak, Qwen-VL catches the inconsistency immediately. This cross-validation between text and image is what separates a toy demo from a real fraud detection system. Tool calling: Qwen's ability to decide WHEN to call external tools (like weather APIs) and HOW to interpret the results enables the Investigation Node to act autonomously without hard-coded logic. Integration challenge: The DashScope API required careful configuration of the international endpoint (dashscope-intl.aliyuncs.com) and proper API key management through Alibaba Cloud's RAM (Resource Access Management) service. I created a dedicated RAM user (claimflow-dev) with minimal permissions — following the principle of least privilege even in a hackathon project. Day 5-6: The Frontend and Human-in-the-Loop Track 4 explicitly requires "production-readiness over toy demos." The most production-ready pattern in AI? Human-in-the-loop. I built a two-panel Streamlit dashboard: Left Panel (Customer Portal): Submit claims with text description and photo upload Right Panel (Analyst Dashboard): Real-time visualization of the AI agent's reasoning process, with approve/reject actions and audit trail The critical UX detail: the analyst sees WHY the AI flagged something, not just that it did. Every inconsistency is listed with evidence: ❌ Image shows water damage but text claims fire ❌ Weather data shows clear skies on reported storm date ⚠️ No structured data could be extracted — manual review required This transparency builds trust. The AI augments human judgment; it never replaces it. Internationalization: Since this is a global hackathon, I implemented full i18n support (English, Portuguese, Spanish) with a single environment variable switch. The system defaults to English but can serve Latin American or European markets without code changes. Day 7-8: Hardening for Production A demo that crashes during judging is worse than no demo at all. I spent two full days on resilience: Security: API key authentication (X-API-Key header) on all protected endpoints File upload hardening: 10MB size limit, MIME type validation, magic byte verification to prevent extension spoofing PII redaction in logs (names, emails, CPF numbers) Observability: Structured logging with request_id and correlation_id on every log line Graph node duration tracking (duration_ms) Prometheus-format /metrics endpoint (claims_submitted, claims_approved, claims_rejected, avg_processing_time) Request ID middleware echoing X-Request-ID, X-Correlation-ID, and X-Response-Time-Ms on responses Testing: 115+ tests passing across graph nodes, vision service, weather tool, storage backends, review API, authentication, file validation, and observability 82% code coverage End-to-end test of the full submit → process → review → decision flow Day 9: Infrastructure and CI/CD Docker: Multi-stage Dockerfile with non-root user, plus docker-compose.yml for one-command deployment (backend + frontend + PostgreSQL). GitHub Actions CI: Automated lint (ruff), test (pytest with coverage), and build verification on every push. The CI badge in the README proves code quality is continuously enforced. PostgreSQL: Alembic migrations with async SQLAlchemy. The system defaults to in-memory storage for demos but switches to PostgreSQL persistence by setting a single DATABASE_URL environment variable. Day 10: Demo, Document, Deliver The final day was about making everything accessible and verifiable: Architecture diagram (Mermaid.js) showing all four layers and data flows Alibaba Cloud proof with console screenshots proving real DashScope API usage 3-minute demo video showing the full pipeline detecting a fraudulent claim Comprehensive README with setup instructions, architecture overview, and API documentation What I Learned in 10 Days Orchestration > Prompting. The value isn't in a single clever prompt — it's in how you chain multiple AI calls with deterministic routing and error handling. LangGraph's state machine was essential for this. Multimodal cross-validation is the killer feature. Text-only fraud detection misses obvious visual inconsistencies. Qwen-VL's ability to analyze images AND compare them against text claims is what makes Claimflow genuinely useful. Fail-closed is non-negotiable. In any system handling real money, "I couldn't verify this" must mean "escalate to human," not "approve anyway." This single design decision separates production systems from prototypes. Transparency builds trust. Showing the analyst WHY the AI flagged something (with evidence) is more important than the flag itself. Black-box AI doesn't get adopted in enterprise — explainable AI does. 10 days is enough — if you architect first. The two days spent on architecture before writing code saved me from at least three major refactors. Design documents are force multipliers in sprints.

Log in or sign up for Devpost to join the conversation.

posted an update

What's Next

Video demo production (2:45 final cut) Automated testing with Playwright Qwen-VL integration for satellite image analysis Multi-language support (PT/EN/ES) We'd Love Your Feedback! Star our repo: github.com/kaiquetheodoro/TerraPilot

Question for the community: Have you worked with MCP tool integration before? I'd love to hear your patterns for error handling and fallback strategies!

Log in or sign up for Devpost to join the conversation.

posted an update

TerraPilot Update: Real Geospatial APIs Now Live!

Exciting progress on our autonomous CAR validation agent! I just crossed a major milestone connecting real Brazilian government APIs to our MCP-powered Qwen agent.

What's New

Real Geolocation via Nominatim/OSM

Our MCP server now queries live OpenStreetMap data through reverse geocoding, returning:

  • Validated municipality and state
  • Biome identification
  • Full Brazilian address resolution
  • In-country validation checks

Protected Areas Detection

Our check_protected_areas_overlap tool cross-references GPS coordinates against: Federal Conservation Units (UCs) Indigenous Territories (TIs) Permanent Preservation Areas (APPs)

Alibaba Cloud Deployment Proof

Full integration code now live in alicloud/deployment.py: Tablestore with geospatial Search Index SLS for LGPD-compliant audit trails OSS for farmer photo storage ECS deployment automation via Docker

UX Polish

Earthy green/brown palette inspired by Brazilian biomes Offline-first PWA with multi-photo uploads Luana's dashboard with AI confidence-based priority queue Dual Hackathon Strategy

TerraPilot is now competing in two tracks simultaneously: Alibaba Cloud Global AI Hackathon — Track 4: Autopilot Agent haCARthon 2026 — Brazilian Government's CAR as Digital Public Good challenge Same codebase, different evaluation criteria. Our technical depth serves Alibaba's judges while our social impact serves Brazil's environmental governance mission.

Built with love for Brazil's 6M+ rural farmers and protected forests

QwenCloud #AlibabaCloud #MCP #AutopilotAgent #EnvironmentalAI #DigitalPublicGood

Log in or sign up for Devpost to join the conversation.