Inspiration
Small businesses drown in email. A quote request, a support ticket, a scheduling ask, and a high-stakes contract renewal all land in the same inbox -- and someone has to triage, route, and act on each one. We wanted to build an agent that does this automatically, using a tiered Qwen model stack that matches model capability to task complexity.
What it does
FlowPilot is an autonomous business workflow engine. It:
- Triages incoming emails using qwen-flash (fast, cheap classification: category + urgency + routing key)
- Plans and executes the appropriate workflow using qwen-plus via a multi-turn tool-calling loop (get_customer_history, lookup_pricing, check_calendar, create_support_ticket, send_email_reply, flag_for_human_review)
- Gates high-risk actions -- any quote over $1,000 or contract/legal category pauses and routes to a human approver before firing
- Audits everything using qwen3-max, generating a structured audit entry with a quality score (0-10) for every processed email
Demo scenarios:
- Quote request (50 units) -> pricing lookup -> email reply with breakdown
- Critical outage report -> support ticket created -> confirmation sent
- Meeting request -> calendar availability check -> slots proposed
- $85k enterprise contract renewal -> HUMAN GATE triggered (10/10 risk score)
How we built it
Three-tier Qwen model architecture:
| Tier | Model | Job |
|---|---|---|
| Triage | qwen-flash | Classify email, score urgency, select workflow |
| Planner | qwen-plus | Multi-turn tool-calling loop, execute workflow steps |
| Audit | qwen3-max | Generate structured audit entry + quality score |
Built with Python, using the OpenAI-compatible DashScope API (base URL: dashscope-intl.aliyuncs.com). Tool definitions are JSON Schema -- the same format as n8n nodes -- making the workflow pack library directly reusable. SQLite state store tracks every task: status, timestamps, model used, tokens consumed.
Challenges
Getting the human-in-the-loop gate architecture right was the core engineering challenge. The gate needs to pause mid-workflow (after planning, before executing), serialise state to SQLite, notify the approver, and resume cleanly when approval arrives. We also had to tune the triage prompt to reliably output structured JSON from qwen-flash without a JSON mode forcing function.
Accomplishments
- Three Qwen models doing distinct jobs in a clean pipeline (no single model doing everything)
- Stateful task ledger: every email gets a task_id that traces through triage -> plan -> gate (if triggered) -> execute -> audit
- Human gate fires correctly on the $85k contract (score 10/10) and passes through the $200 quote (score 4/10)
- All 4 demo scenarios run end-to-end in under 10 seconds per email
What we learned
qwen-flash is remarkably good at structured classification -- it reliably outputs valid JSON triage objects with correct routing keys. qwen-plus handles multi-turn tool-calling loops well, completing complex workflows in 2-4 tool calls. qwen3-max adds genuine value at the audit layer: its quality scores correlate with actual workflow complexity.
What's next
Deploy to Alibaba Cloud ECS (Singapore region) for production. Add a web-based approval UI for the human gate. Expand workflow packs to cover more business categories. Integrate with real Gmail via OAuth.
Log in or sign up for Devpost to join the conversation.