<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zuhaib Ahmed</title>
    <description>The latest articles on DEV Community by Zuhaib Ahmed (@zuhaibahmed7).</description>
    <link>https://dev.to/zuhaibahmed7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4014143%2Fead9072f-a5d8-465b-a478-d6ede155ded6.png</url>
      <title>DEV Community: Zuhaib Ahmed</title>
      <link>https://dev.to/zuhaibahmed7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zuhaibahmed7"/>
    <language>en</language>
    <item>
      <title># Building MediAssist: An AI Health Agent with Persistent Memory Using Qwen + MongoDB</title>
      <dc:creator>Zuhaib Ahmed</dc:creator>
      <pubDate>Fri, 03 Jul 2026 21:45:17 +0000</pubDate>
      <link>https://dev.to/zuhaibahmed7/-building-mediassist-an-ai-health-agent-with-persistent-memory-using-qwen-mongodb-k46</link>
      <guid>https://dev.to/zuhaibahmed7/-building-mediassist-an-ai-health-agent-with-persistent-memory-using-qwen-mongodb-k46</guid>
      <description>&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;Millions of people around the world struggle to get reliable health information quickly. &lt;br&gt;
I wanted to build something that could help — a conversational AI agent that not only &lt;br&gt;
answers health questions but actually &lt;em&gt;remembers&lt;/em&gt; you over time.&lt;/p&gt;

&lt;p&gt;This is my journey building MediAssist for the Qwen Cloud Hackathon 2026.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is MediAssist?
&lt;/h2&gt;

&lt;p&gt;MediAssist is a conversational AI health information agent that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Answers health questions in plain language&lt;/li&gt;
&lt;li&gt;Remembers your name, allergies, and health history across sessions&lt;/li&gt;
&lt;li&gt;Shows your full chat history (like ChatGPT)&lt;/li&gt;
&lt;li&gt;Deployed live on Alibaba Cloud ECS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Live demo: &lt;a href="http://47.84.195.213:8501" rel="noopener noreferrer"&gt;http://47.84.195.213:8501&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Qwen Cloud (qwen-plus)&lt;/strong&gt; — The AI brain of the agent&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MongoDB Atlas&lt;/strong&gt; — Persistent memory storage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streamlit&lt;/strong&gt; — Web interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alibaba Cloud ECS&lt;/strong&gt; — Cloud deployment (Singapore)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python 3.9&lt;/strong&gt; — Backend language&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;The architecture is straightforward:&lt;br&gt;
User → Streamlit UI (Alibaba Cloud ECS)&lt;br&gt;
↓&lt;br&gt;
Agent Logic (Qwen API)&lt;br&gt;
↓&lt;br&gt;
MongoDB Atlas (memory storage)&lt;/p&gt;
&lt;h2&gt;
  
  
  The MemoryAgent Challenge
&lt;/h2&gt;

&lt;p&gt;The most interesting part was implementing true persistent memory. &lt;br&gt;
Most chatbots forget everything when you close the browser. &lt;br&gt;
MediAssist doesn't.&lt;/p&gt;

&lt;p&gt;I used two separate state variables in Streamlit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;memory_context&lt;/code&gt; — Never cleared, survives new conversations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;messages&lt;/code&gt; — Display only, cleared on "New Conversation"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means even when you start a fresh conversation, &lt;br&gt;
the agent still knows who you are!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# When user starts new conversation
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;New Conversation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;  &lt;span class="c1"&gt;# Clear display
&lt;/span&gt;    &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid4&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="c1"&gt;# memory_context stays intact!
&lt;/span&gt;    &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rerun&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  MongoDB Collections
&lt;/h2&gt;

&lt;p&gt;I designed three collections for MediAssist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;users&lt;/code&gt; — User profiles (name, email, allergies, conditions)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;chat_history&lt;/code&gt; — Full conversation logs per session&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;symptom_logs&lt;/code&gt; — Health concern tracking over time&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Biggest Challenge
&lt;/h2&gt;

&lt;p&gt;Deploying on Alibaba Cloud ECS with CentOS 7 was unexpectedly tricky. &lt;br&gt;
The default Python version was 3.6, which didn't support the modern &lt;br&gt;
Qwen/OpenAI SDK. I had to compile Python 3.9 from source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /usr/src
wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz
&lt;span class="nb"&gt;tar &lt;/span&gt;xzf Python-3.9.18.tgz
&lt;span class="nb"&gt;cd &lt;/span&gt;Python-3.9.18
./configure &lt;span class="nt"&gt;--enable-optimizations&lt;/span&gt;
make altinstall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then pyarrow (a Streamlit dependency) needed cmake 3.25+ but CentOS 7 &lt;br&gt;
only had 3.17. The fix was installing a pre-built pyarrow wheel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;&lt;span class="nv"&gt;pyarrow&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;10.0.1
pip &lt;span class="nb"&gt;install &lt;/span&gt;&lt;span class="nv"&gt;streamlit&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;1.28.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Qwen Cloud API&lt;/strong&gt; is fully OpenAI-compatible — easy to integrate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MongoDB Atlas&lt;/strong&gt; is perfect for storing conversational AI memory&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alibaba Cloud ECS&lt;/strong&gt; free trial gives generous resources for hackathons&lt;/li&gt;
&lt;li&gt;Separating display state from memory context is crucial for persistent AI agents&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MongoDB Atlas Vector Search for semantic symptom matching&lt;/li&gt;
&lt;li&gt;Multilingual support&lt;/li&gt;
&lt;li&gt;Medication reminder system&lt;/li&gt;
&lt;li&gt;Mobile app&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Yourself
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Demo:&lt;/strong&gt; &lt;a href="http://47.84.195.213:8501" rel="noopener noreferrer"&gt;http://47.84.195.213:8501&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/zuhaibahmed7/mediassist-agent" rel="noopener noreferrer"&gt;https://github.com/zuhaibahmed7/mediassist-agent&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built for the Qwen Cloud Hackathon 2026 — MemoryAgent Track 🏆&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
