<?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: Morad Moqbel</title>
    <description>The latest articles on DEV Community by Morad Moqbel (@morad_moqbel).</description>
    <link>https://dev.to/morad_moqbel</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%2F4115159%2Fcf2f7800-00f0-441e-b315-2fc9c26fa8ea.png</url>
      <title>DEV Community: Morad Moqbel</title>
      <link>https://dev.to/morad_moqbel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morad_moqbel"/>
    <language>en</language>
    <item>
      <title>How We Built an Autonomous AI Agent That Audited 187 Subprojects and Got PRs Merged by Google Cloud Engineers</title>
      <dc:creator>Morad Moqbel</dc:creator>
      <pubDate>Tue, 08 Sep 2026 07:36:19 +0000</pubDate>
      <link>https://dev.to/morad_moqbel/how-we-built-an-autonomous-ai-agent-that-audited-187-subprojects-and-got-prs-merged-by-google-cloud-3iij</link>
      <guid>https://dev.to/morad_moqbel/how-we-built-an-autonomous-ai-agent-that-audited-187-subprojects-and-got-prs-merged-by-google-cloud-3iij</guid>
      <description>&lt;p&gt;Every developer building with AI frameworks in 2026 knows the pain: &lt;strong&gt;fast-moving dependencies break existing code constantly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A library releases v0.2, changes an import path, deprecates a decorator, or alters a dictionary response into an object. Suddenly, your production app throws &lt;code&gt;NameError&lt;/code&gt;, &lt;code&gt;ImportError&lt;/code&gt;, or silent runtime failures.&lt;/p&gt;

&lt;p&gt;We got tired of spending hours hunting through changelogs to fix broken API signatures. So we built &lt;strong&gt;ApiPatch&lt;/strong&gt; — an autonomous AI agent engineered specifically to detect and repair deprecated API calls across codebases, verify them against syntax and AST integrity shields, and automatically generate clean, partitioned pull requests.&lt;/p&gt;

&lt;p&gt;To put ApiPatch to the ultimate test, we pointed it at one of the largest and most popular GenAI repositories on GitHub: &lt;strong&gt;&lt;a href="https://github.com/Shubhamsaboo/awesome-llm-apps" rel="noopener noreferrer"&gt;Shubhamsaboo/awesome-llm-apps&lt;/a&gt;&lt;/strong&gt; (15,000+ stars), containing over 180 independent LLM subprojects.&lt;/p&gt;

&lt;p&gt;Here is the story of how ApiPatch audited the monorepo, generated automated fixes, and got its first Pull Request merged by a Google Cloud AI engineer.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: The Modern Dependency Churn
&lt;/h2&gt;

&lt;p&gt;Frameworks like &lt;strong&gt;CrewAI, LangChain, FastAPI, and Google GenAI SDK&lt;/strong&gt; are evolving at breakneck speed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FastAPI deprecated &lt;code&gt;@app.on_event("startup")&lt;/code&gt; in favor of asynchronous &lt;code&gt;lifespan&lt;/code&gt; context managers.&lt;/li&gt;
&lt;li&gt;Google deprecated &lt;code&gt;google.generativeai&lt;/code&gt; in favor of the new unified &lt;code&gt;google-genai&lt;/code&gt; SDK, changing function signatures from &lt;code&gt;content=&lt;/code&gt; to &lt;code&gt;contents=&lt;/code&gt; and returning vector objects rather than raw dictionaries.&lt;/li&gt;
&lt;li&gt;LLM routers moved from legacy configuration keys to updated provider schemas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a monorepo with 180+ standalone tutorials, keeping every subproject up-to-date manually is nearly impossible.&lt;/p&gt;




&lt;h2&gt;
  
  
  Enter ApiPatch: How It Works
&lt;/h2&gt;

&lt;p&gt;ApiPatch is not a generic code re-writer. It combines &lt;strong&gt;deterministic AST analysis with targeted LLM reasoning&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Monorepo Discovery&lt;/strong&gt;: Scans project trees, automatically detecting subproject roots (directories with their own &lt;code&gt;requirements.txt&lt;/code&gt; or &lt;code&gt;pyproject.toml&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proactive Audit&lt;/strong&gt;: Analyzes call sites against known deprecation patterns across major frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AST Integrity &amp;amp; Syntax Shield&lt;/strong&gt;: Before proposing any change, ApiPatch compiles the modified code through AST validation and checks for import ordering and syntax regressions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated Branching &amp;amp; PR Generation&lt;/strong&gt;: Automatically partitions fixes into dedicated Git branches and opens surgical Pull Requests on GitHub.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Real-World Test: Merged PRs on awesome-llm-apps
&lt;/h2&gt;

&lt;p&gt;We ran ApiPatch on &lt;code&gt;awesome-llm-apps&lt;/code&gt; using subproject-level isolation. Here are the patches it generated:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Modernizing RouteLLM Config (PR #1148 — MERGED 🎉)
&lt;/h3&gt;

&lt;p&gt;Migrated legacy controller configurations to modern RouteLLM API parameters. Verified clean runtime execution and was promptly merged by maintainer &lt;strong&gt;@Shubhamsaboo&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;- controller = Controller(config="legacy_router.yaml")
&lt;/span&gt;&lt;span class="gi"&gt;+ controller = Controller(model_pair="gpt-4o:claude-4-5-sonnet")
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. FastAPI Startup to Modern Lifespan (PR #1149)
&lt;/h3&gt;

&lt;p&gt;Replaced the deprecated startup event with FastAPI's official &lt;code&gt;asynccontextmanager&lt;/code&gt; pattern, ensuring clean app initialization:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;- @app.on_event("startup")
- def startup_event():
-     initialize_indexes()
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+ @asynccontextmanager
+ async def lifespan(app: FastAPI):
+     initialize_indexes()
+     yield
+
+ app = FastAPI(lifespan=lifespan)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Google Generative AI to Unified google-genai SDK (PR #1150)
&lt;/h3&gt;

&lt;p&gt;Upgraded legacy &lt;code&gt;google.generativeai&lt;/code&gt; embed calls to the new &lt;code&gt;google-genai&lt;/code&gt; types and response structures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;- response = genai.embed_content(model="models/embedding-001", content=text)
- return response['embedding']
&lt;/span&gt;&lt;span class="gi"&gt;+ response = client.models.embed_content(
+     model="text-embedding-004",
+     contents=text,
+     config=types.EmbedContentConfig(task_type="RETRIEVAL_DOCUMENT")
+ )
+ return response.embeddings[0].values
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Key Lessons from Open-Source Code Audits
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Import Order Matters&lt;/strong&gt;: When refactoring decorators (like FastAPI &lt;code&gt;lifespan&lt;/code&gt;), the instance creation &lt;code&gt;app = FastAPI(...)&lt;/code&gt; must precede any route definitions (&lt;code&gt;@app.get&lt;/code&gt;), or Python will fail at import time with &lt;code&gt;NameError&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synchronize Dependencies&lt;/strong&gt;: Upgrading an SDK in code without updating &lt;code&gt;requirements.txt&lt;/code&gt; breaks clean container environments. ApiPatch now aligns requirements files alongside code diffs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintainer Etiquette&lt;/strong&gt;: Large repos hate 50-file mega-PRs. Grouping fixes per subproject with clear explanations is what earns maintainer respect.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try ApiPatch in Your CI/CD or CLI
&lt;/h2&gt;

&lt;p&gt;ApiPatch is open-source and available both on PyPI and as an official &lt;strong&gt;GitHub Action&lt;/strong&gt; on the GitHub Marketplace:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Run it locally:
&lt;/h3&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;apipatch
apipatch run &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--mode&lt;/span&gt; fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Add it to your GitHub Actions:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ApiPatch Auto-Migration&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;modernize&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;MoradMoqbel/apipatch@v0.9.0&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;fix'&lt;/span&gt;
          &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GEMINI_API_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;auto_pr&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;true'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Resources &amp;amp; Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;⭐️ &lt;strong&gt;GitHub Repo&lt;/strong&gt;: &lt;a href="https://github.com/MoradMoqbel/apipatch" rel="noopener noreferrer"&gt;MoradMoqbel/apipatch&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🚀 &lt;strong&gt;GitHub Marketplace&lt;/strong&gt;: &lt;a href="https://github.com/marketplace/actions/apipatch-ai-migration-agent" rel="noopener noreferrer"&gt;ApiPatch AI Migration Agent&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;PyPI&lt;/strong&gt;: &lt;a href="https://pypi.org/project/apipatch/" rel="noopener noreferrer"&gt;apipatch 0.9.0&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Have you encountered breaking API changes in your stack recently? Let us know in the comments below!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>github</category>
    </item>
  </channel>
</rss>
