AI News

Siemens Slices the Elephant: AI Agents Tame Legacy Code

Quick answer

Siemens and Google Cloud built Knowledge Fabric, an AI system using knowledge graphs and agentic workflows to modernize massive legacy codebases. Pilot results show major productivity gains.

When your codebase is hundreds of millions of lines deep and spans decades, standard AI tools just don’t cut it. Siemens, a global leader in industrial automation, faced exactly this swampy challenge. Their legacy code was a tangled water-weed of dependencies, documentation, and decades-old decisions. Off-the-shelf coding assistants? They’d get lost in the reeds.

So Siemens teamed up with Google Cloud to build Knowledge Fabric—an AI system that doesn’t just read code, it understands the whole ecosystem. Think of it as a capybara navigating the swamp: calm, deliberate, and aware of every channel and deep pool.

The Problem: Industrial Software Is a Different Beast

Modernizing industrial software is like rebuilding a jet while it’s flying. Siemens had four big hurdles:

  • Scale: Repos far exceed LLM context windows.
  • Fragmentation: Knowledge scattered across code, Jira, Confluence, and scanned PDFs from 2003.
  • Complexity: Tracing a line of code to a requirement from a decade ago? Good luck.
  • Responsibility: Systems must be explainable, traceable, and verifiable for 15–20 year lifecycles. Hallucinations aren’t just annoying—they’re dangerous.

Standard RAG wasn’t enough. Code isn’t just text; it has structure. Flattening it into vectors loses the relationships that matter.

Knowledge Fabric: A Graph-Based Brain

The team built a domain-aware agent using Spanner Graph to model the codebase’s inherent structure. They combined three search methods:

  • Graph Query Language (GQL) for structural queries.
  • Approximate Nearest Neighbors (ANN) for semantic vector search.
  • Full-text search for keyword precision.

Together, these let an agent answer complex questions like: “Which functions need updating if I change the Axis Control Panel?” The system traverses the graph, weighs similarities, and delivers a precise impact analysis.

Slicing the Elephant: Agentic Workflows

Massive tasks overwhelm AI agents. So Siemens adopted a pattern they call “slicing the elephant”—breaking big jobs into smaller, specialized agent tasks:

  • Search agent: Deep-research specialist exploring the code graph.
  • User story agent: Interviews product owners, drafts requirements.
  • Architecture impact agent: Predicts side effects before code is written.
  • Task breakdown agent: Splits work into manageable chunks with full context.
  • Coding agent: Implements the change—finally, with all the context it needs.

Humans stay in the loop at every step, ensuring production-grade reliability. Engineers focus on meaningful work, not repetitive chores.

Pilot Results: From Days to Hours

In a pilot migrating legacy control panels to web interfaces, Knowledge Fabric slashed implementation effort. Dependency analysis that once took senior engineers days now takes far less time. System integrity? Preserved. Quality standards? Met.

Engineers now spend more time creating customer value and less time wrestling with legacy code. That’s the capybara way: smart, efficient, and always keeping an eye on the bigger picture.

Want to build your own graph-based agents? Check out Google Cloud and the Agent Development Kit. And if you’re comparing AI models for your own projects, our pricing comparison might help you pick the right tool for the job.

Original announcement published on Google Cloud.