Microsoft Patents an AI Agent That Fixes Slow Code and Checks Its Own Work
Some of the sneakiest software bugs never crash anything. They just make a program sluggish and memory-hungry. Microsoft's patent describes an AI that hunts those bugs down and measures its own fix.

- Publication number
- US 2026/0377148 A1(US20260377148A1)
- USPTO patent title:
- Agentic Approach to Fixing Software Performance Bugs
- Applicant
- MICROSOFT TECHNOLOGY LICENSING, LLC.
- Filed · Published
- Aug 17, 2025 · Nov 26, 2026
- Inventors
- SPANDAN GARG, NEELAKANTAN SUNDARESAN, ROSHANAK ZILOUCHIAN MOGHADDAM
- Status when we published
- Waiting for an examiner
- Document
- 20 claims
- US classification
- 717/106
- Parent application
- Claims priority from a provisional application 63810533 (filed May 22, 2025)
What Microsoft's code-fixing AI agent actually does
Every time an app feels sluggish or gobbles up your computer's memory, a programmer somewhere has to track down why. The code usually isn't broken. It gives the right answer, just slowly, so nothing crashes and nobody gets an alert.
Microsoft's patent describes an AI agent that takes over that chore. Given a report naming the slow piece of code, it first measures how that code performs today. Then it asks an AI language model what to do next, tries a fix, and measures again. If the numbers didn't improve, it tries another fix.
Only when the before-and-after test shows a real gain does it hand the repaired code back. No engineer has to babysit the process.
… excessive central processing unit (CPU) usage or excessive memory allocations in the target method …
Translation: The system targets software that wastes computer processing power or memory.
How the agent benchmarks, patches and rechecks
The system starts with a bug report that names a target method (a specific chunk of code) and says it uses too much CPU time or makes too many memory allocations (grabs of memory while running). The claims cover those two kinds of problem.
An AI agent does the work: a control program paired with a large language model (the type of AI behind chatbots). The control program has developer tools and access to the codebase. It gives the model an issue description and an ordered to-do list:
- Run a first benchmark test (a timed trial that records CPU and memory use) on the code as it is.
- Write the repair.
- Run a second benchmark with the repair in place.
- Check that performance actually improved.
The model never touches the code itself. It answers one question at a time: what should the control program do next? The control program runs that command, records the result, and asks again. Because the AI service remembers nothing between requests, each request carries the full conversation log of everything said and done so far.
The loop ends once the fix is verified. One dependent claim defines that as at least one metric improving without the others getting worse. The agent can also run inside an isolated container, walled off from other software.
… generates repair code for a software program having a performance bug that is verified to improve the performance of the software program autonomously without user intervention …
Translation: The artificial intelligence fixes slow software by itself and tests the result.
Why Microsoft is aiming AI at slow code
Slow software costs real money and patience: apps drain batteries, and servers need more hardware to do the same job. Because these bugs crash nothing, they can sit in code for ages, and finding them by hand means engineers combing through profiler output (a report showing where a program spends its time). This patent aims to hand that chore to a machine with a built-in check.
The filing's example is a C# QR code generator. The agent swapped one method call for another, and the benchmark showed memory use falling from 98.11 MB to 96.74 MB and average run time from 184.5 ms to 182.6 ms. A small gain, but it was measured. You would feel the effect indirectly, as faster and leaner apps from developers who use tools like this.
Microsoft's 44th filing we've tracked since July in our AI agents acting for you watch follows one on cloud code tracing and one on a pre-emptive meeting helper.
Source: US 2026/0377148 A1 at the USPTO (PDF). Full patent text and figures are in the official publication.
Get our take in your Top Stories
Liked this breakdown? Add Patentlyze as a preferred source on Google, and our plain-English take shows up more often in your Top Stories the next time Microsoft patent news breaks.
We read the new patents from Big Tech, carmakers and more and send you the ones worth knowing. Plain English, free, every week.
The drawings · 9 sheets
9 drawing sheets from US 2026/0377148 A1 · click any drawing to enlarge

No comments yet