<?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: Mikhail Ikpoma</title>
    <description>The latest articles on DEV Community by Mikhail Ikpoma (@validivar).</description>
    <link>https://dev.to/validivar</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3983848%2F42a06a8a-a7fa-4d19-a27a-1238dd03fd3d.png</url>
      <title>DEV Community: Mikhail Ikpoma</title>
      <link>https://dev.to/validivar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/validivar"/>
    <language>en</language>
    <item>
      <title>From Billing Alerts to Autonomous Action: Building SpendPilot with Qwen Cloud.</title>
      <dc:creator>Mikhail Ikpoma</dc:creator>
      <pubDate>Sun, 14 Jun 2026 12:24:55 +0000</pubDate>
      <link>https://dev.to/validivar/from-billing-alerts-to-autonomous-action-building-spendpilot-with-qwen-cloud-2cii</link>
      <guid>https://dev.to/validivar/from-billing-alerts-to-autonomous-action-building-spendpilot-with-qwen-cloud-2cii</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Cloud waste is a silent budget killer. Industry reports estimate that companies waste up to 30% of their cloud spend on idle resources, misconfigurations, and forgotten instances. For FinOps and SRE teams, this means drowning in a sea of billing alerts, manually cross-referencing CloudMonitor metrics, and writing fragile bash scripts to clean up the mess.&lt;br&gt;
For the recent Qwen Cloud Hackathon, my team and I asked a simple question: What if an AI agent could handle this entire workflow end-to-end, safely and autonomously?&lt;br&gt;
The answer is SpendPilot, an autonomous FinOps agent that detects billing anomalies, diagnoses root causes, and executes cost-saving optimizations. Here is the story of how we built it, the challenges we faced, and why Qwen Cloud was the secret sauce that made it possible.&lt;/p&gt;

&lt;p&gt;🏗️ &lt;strong&gt;The Architecture&lt;/strong&gt;: &lt;em&gt;&lt;strong&gt;More Than Just a Chatbot&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
We knew early on that a simple linear prompt chain wouldn’t cut it. Real-world cloud operations require state management, tool calling, and the ability to loop until a problem is solved.&lt;br&gt;
We chose LangGraph for orchestration, paired with a FastAPI backend deployed on Alibaba Cloud ECS. But the true brain of the operation is powered by Qwen Cloud via the DashScope API.&lt;br&gt;
Our architecture follows a clear, safe loop:&lt;br&gt;
Ingest: A billing alert webhook triggers the agent.&lt;br&gt;
Reason: Qwen-Max analyzes the alert and decides which Alibaba Cloud SDK tools to call (e.g., query_billing_anomaly, get_resource_metrics).&lt;br&gt;
Act: If the agent identifies a severely underutilized ECS instance, it proposes an optimization (like stopping the instance).&lt;br&gt;
Guardrail: If the action is destructive, the agent pauses for Human-in-the-Loop (HITL) approval via Slack.&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;The "Aha!" Moment&lt;/strong&gt;: &lt;em&gt;&lt;strong&gt;Giving the Agent Persistent Memory&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Early in development, we hit a major wall: Context Amnesia.&lt;br&gt;
If the agent successfully diagnosed and fixed an idle RDS database on Tuesday, it would completely forget that solution when the same alert fired on Thursday. It was wasting tokens and time re-learning the same problem.&lt;br&gt;
This is where Qwen’s text-embedding-v3 model saved the day.&lt;br&gt;
We implemented a "MemoryAgent" crossover architecture. Every time SpendPilot resolves an incident, it summarizes the event and stores it in a local FAISS vector database using Qwen embeddings. The next time an alert fires, the agent performs a similarity search before making any tool calls.&lt;br&gt;
Here is a snippet of how we integrated Qwen Embeddings into our memory module:&lt;/p&gt;

&lt;p&gt;from langchain_community.vectorstores import FAISS&lt;br&gt;
from langchain_openai import OpenAIEmbeddings&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Qwen Embeddings via DashScope OpenAI-compatible endpoint
&lt;/h1&gt;

&lt;p&gt;embeddings = OpenAIEmbeddings(&lt;br&gt;
    model="text-embedding-v3",&lt;br&gt;
    openai_api_key=os.getenv("DASHSCOPE_API_KEY"),&lt;br&gt;
    openai_api_base="&lt;a href="https://dashscope.aliyuncs.com/compatible-mode/v1" rel="noopener noreferrer"&gt;https://dashscope.aliyuncs.com/compatible-mode/v1&lt;/a&gt;"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;def get_past_incidents(query: str) -&amp;gt; str:&lt;br&gt;
    db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization=True)&lt;br&gt;
    docs = db.similarity_search(query, k=2)&lt;br&gt;
    return "\n".join([doc.page_content for doc in docs])&lt;/p&gt;

&lt;p&gt;Watching the agent instantly retrieve a past fix and skip the diagnostic phase entirely was a massive breakthrough. It transformed SpendPilot from a reactive tool into a learning system.&lt;/p&gt;

&lt;p&gt;🛡️ &lt;strong&gt;The Safety Challenge&lt;/strong&gt;: &lt;em&gt;&lt;strong&gt;Human-in-the-Loop (HITL)&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Building an agent that can execute alibabacloud_ecs SDK commands to stop production servers is inherently risky. We quickly realized that full autonomy without guardrails is a non-starter for enterprise adoption.&lt;br&gt;
We solved this by teaching Qwen-Max to recognize intent. We added a strict rule to our system prompt: If you need human approval to execute a destructive action, output exactly 'APPROVAL_REQUIRED: [action]'.&lt;br&gt;
When the LangGraph state machine detects this string, it halts execution and routes the request to a Slack approval workflow. This hybrid approach gives us the speed of AI with the safety of human oversight.&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Why Qwen Cloud?&lt;/strong&gt;&lt;br&gt;
We evaluated several LLM providers, but Qwen Cloud stood out for three reasons:&lt;br&gt;
Exceptional Tool-Calling Accuracy: Qwen-Max consistently formatted our JSON tool calls for the Alibaba Cloud SDKs without hallucinating parameters.&lt;br&gt;
were crucial for building the memory feature without blowing up our token budget.&lt;br&gt;
Seamless Alibaba Cloud Ecosystem: Using DashScope alongside native Alibaba Cloud SDKs (BSS, CloudMonitor, ECS) created a frictionless, high-performance pipeline.&lt;/p&gt;

&lt;p&gt;🔮 &lt;strong&gt;What’s Next for SpendPilot?&lt;/strong&gt;&lt;br&gt;
While our hackathon prototype is fully functional, our roadmap is just getting started:&lt;br&gt;
Migrating our local FAISS memory to Alibaba Cloud AnalyticDB for PostgreSQL for scalable, distributed memory.&lt;br&gt;
Expanding our toolset to include automated lifecycle management for OSS and RDS.&lt;br&gt;
Deepening integrations with enterprise ITSM platforms like Jira and PagerDuty.&lt;/p&gt;

&lt;p&gt;🙌 &lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Building SpendPilot was a crash course in stateful AI orchestration, cloud infrastructure, and the importance of safety guardrails. Qwen Cloud provided the robust reasoning and embedding capabilities we needed to turn a complex FinOps nightmare into a streamlined, autonomous workflow.&lt;/p&gt;

&lt;p&gt;Want to see it in action or contribute?&lt;br&gt;
🔗 Check out the source code on GitHub: [&lt;a href="https://github.com/validivar/spendPilot" rel="noopener noreferrer"&gt;https://github.com/validivar/spendPilot&lt;/a&gt;]&lt;br&gt;
🔗 View our Devpost Submission: [&lt;a href="https://devpost.com/software/spendpilot?ref_content=user-portfolio&amp;amp;ref_feature=in_progress" rel="noopener noreferrer"&gt;https://devpost.com/software/spendpilot?ref_content=user-portfolio&amp;amp;ref_feature=in_progress&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;Built with ❤️ for the Qwen Cloud Hackathon.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
