How I Built MailOS: My Journey With Qwen Cloud
DEV Community

How I Built MailOS: My Journey With Qwen Cloud

I want to tell you a story. Not the polished kind you see on a pitch deck, but the real one - the late nights, the small wins, the moments I almost gave up, and how Qwen Cloud carried this whole thing on its back.

The Problem That Wouldn't Leave Me Alone

If you have ever run a small business, or even just managed a busy inbox, you know the pain. Email doesn't stop. Customers dey ask questions. Suppliers dey negotiate price. Newsletters dey pile up unread. And somewhere in that pile is the one email that actually matters - the one you missed because you were tired and scrolling too fast.

I kept asking myself: why is email still this dumb? We have AI that can write essays, generate images, even hold a conversation better than some humans. But my inbox? Still sitting there, doing nothing, waiting for me to read every single message myself. That question refused to leave me. So I decided to build something.

Why I Chose Qwen Cloud

I tried a few things before I landed on Qwen. Some models were fast but shallow - they could classify an email as "spam" or "not spam" but couldn't hold a real negotiation across many back-and-forth messages. Some were smart but too expensive to run for every single email that touches an inbox, and email touches your inbox a lot.

Qwen Cloud surprised me. It was strong enough to read a messy, badly-formatted business email and actually understand the intent behind it - is this person trying to sell me something, complain, or trick me? It was fast enough that I could run it on almost every message without my server crying for help. And honestly, setting it up wasn't stressful at all. I created an account on Alibaba Cloud's Model Studio, generated an API key in a few minutes, dropped it into my .env file, and I was talking to Qwen from my code before my coffee got cold. That was the moment I knew: this is the engine my project needed.

Building MailOS, One Agent at a Time

I didn't want to build "just another AI email assistant" that summarizes your inbox and calls it a day. I wanted something that could actually act - read mail, judge if it's dangerous, understand what it wants, and in some cases, respond and negotiate on its own, without me babysitting every message.

So I broke the work into small, focused agents, each one doing one job well:

  • Guardian checks every incoming email for phishing and prompt injection before anything else touches it. I built this one first because trust is everything - if my system can be tricked by a bad email, nothing else matters.
  • Classification figures out what kind of email it is - customer message, invoice, meeting request, newsletter, spam.
  • Memory remembers what matters. Not everything, just the important stuff, the way a good assistant would.
  • Newsletter Intelligence reads through newsletters, pulls out the ideas and trends worth knowing, so I don't have to read fifteen newsletters myself.
  • Decision looks at everything and decides: archive this, notify the owner, draft a reply, ignore it, or hand it over to a human because it's too important to guess.
  • Negotiation is the one I'm most proud of. This agent can actually go back and forth with another mailbox - asking for a better price, agreeing on payment terms - all inside a policy I set. It has a hard round limit and a confidence floor, so it never runs wild. If it's not sure, it stops and calls me.

Every one of these agents leans on Qwen Cloud to think. Not blindly - I never let the AI make the final call on money or risk by itself. The AI proposes, my code decides. That balance took me a while to get right, but it's the part I trust the most now.

The Moment It Actually Worked

I remember the first time I watched MailOS negotiate a deal by itself. I sent an opening offer through the API, walked away to make food, and came back to find three full rounds of back-and-forth had happened - politely, professionally, in plain English, over normal email - and it landed inside the price range I had set. Nobody touched a keyboard except me at the very start. I just sat there staring at my screen. That's when this stopped feeling like a hackathon project and started feeling like something real.

Taking It to Alibaba Cloud

Building it on my laptop was one thing. Making it live for the world was another matter entirely. I moved MailOS to an Alibaba Cloud ECS instance - a simple Ubuntu server, nothing fancy, 2 vCPUs and 2GB of RAM was more than enough to start. I installed Node.js, cloned my repo, set my environment variables, and ran the whole thing under PM2 so it restarts itself if anything goes wrong. Then I put it behind Nginx with HTTPS so my login sessions stay safe.

Watching MailOS run on a real server, connected to a real mailbox, reading real mail, all powered by Qwen Cloud sitting quietly in the background - that was a proud moment for me. No wahala, no drama. It just worked.

What I Learned

Building MailOS taught me something I didn't expect: the hard part of AI agents isn't making them smart. It's making them trustworthy. Anybody can wire an API call to a language model and call it "AI-powered." The real work is in the guardrails - the policy checks, the round caps, the moments where the system says "I'm not sure, let a human decide." Qwen Cloud gave me the intelligence. I had to build the discipline around it.

Where This Is Going

MailOS isn't stopping here. I'm working on a way to export an agent's whole memory so you can move it between servers without starting from zero. I'm also building something wild - a trust score that remembers how every contact behaved in past negotiations, so MailOS treats a trustworthy supplier differently from a stranger, automatically. And the one that still makes people's eyes widen when I explain it: teaching MailOS to pick up the phone and make an actual voice call when an email negotiation stalls, then write the outcome back into the thread like nothing happened.

Email was never designed for this. But with Qwen Cloud doing the thinking underneath, I don't think that's a limitation anymore. It's just the starting point.

If you want to see it, break it, or build on top of it, MailOS is open source. Come and look at https://github.com/mitmelon/mailos. Built with a lot of coffee, a lot of debugging, and Qwen Cloud carrying the intelligence the whole way. Thanks for reading.

Top Comments

I think the most important sentence in the whole article is: β€œThe AI proposes, my code decides.” That captures the difference between an AI demo and an AI system you can actually trust. I also appreciate that you focused on guardrails instead of only model quality. Round limits, confidence thresholds, and human escalation are much more interesting than simply saying a model is β€œsmart.”

One area I’d love to see expanded is the decision layer itself. For example, how are negotiation policies represented? Are they deterministic rules evaluated after the LLM proposes an action, or does the model participate in policy interpretation as well? Likewise, how does the Guardian distinguish prompt injection from legitimate business emails without becoming overly conservative?

The architecture sounds promising, and a deeper write-up on the policy engine and trust boundaries would be just as interesting as the choice of model.

Comments

No comments yet. Start the discussion.