Finance

AI-powered mainframe modernization: Agentic AI for complex legacy codebases

How an IT service provider in the financial sector is automating the understanding of COBOL and Java systems using intelligent code graphs and large language models.
View of a screen with hands on the keyboard below

Initial Situation

A leading IT service provider in the financial sector faced the strategic challenge of efficiently maintaining legacy mainframe systems while preparing them for the future. The extensive codebase, consisting of complex Cobol and Java structures, tied up significant maintenance resources. As original development knowledge became increasingly difficult to access due to generational turnover, the company recognized an opportunity to accelerate knowledge transfer through innovative technologies. The goal was to provide new developers and architects with a tool that would allow them to gain a deep understanding of the legacy systems, thereby laying a solid foundation for the planned replacement and modernization of the mainframe architecture.

Our Solution

To make the complexity of the legacy codebase manageable, AMAI developed an innovative, agent-based solution. The system allows developers to ask natural language questions directly to the code and receive precise answers generated through an autonomous analysis of the software architecture.

  • Graph-based code analysis and AST transformation: The foundation of the solution is the complete transformation of code repositories into structured data. Both Cobol and Java source code were broken down into Abstract Syntax Trees (AST) and converted into a comprehensive call graph. This graph represents not only the file structure but also the logical dependencies and call chains between various classes and modules. This creates a navigable map of the entire software architecture that goes far beyond simple text search and enables deep semantic analysis.
  • Hierarchical bottom-up summarization: To provide the AI model with an understanding of the vast codebase, an innovative summarization process was implemented. Starting from individual files and classes, semantic descriptions are generated and aggregated hierarchically up to the folder level. This method ensures that the agent not only knows the details but also understands the functional context of entire modules. This enables efficient navigation through the code, as the agent can decide at any level which path is relevant for answering a question.
  • Agentic AI with Model Context Protocol (MCP): The heart of the application is an autonomous AI agent that interacts directly with the graph database via the Model Context Protocol (MCP). Instead of following rigidly pre-programmed paths, the agent can dynamically decide which tools to use—whether searching for nodes, tracing parent-child relationships, or analyzing the shortest path between two components. This flexibility allows the system to independently handle even complex queries through iterative solution steps and logical reasoning.
  • Semantic search for legacy code: By combining vector databases and large language models, we created a powerful semantic search. Developers no longer need to search for exact variable names; instead, they can ask questions like "Where is the interest calculation implemented?" or "How are module A and B related?". The agent understands the intent of the question, navigates through the semantically enriched graph, and provides context-aware answers that help developers quickly grasp the implementation details and interdependencies of the legacy systems.

Despite the challenge of extremely long causal chains in the legacy logic and the sheer size of the repositories, the abstraction provided by graphs and summarization allowed for the creation of a high-performance solution.

Results & Business Impact

The evaluation of the AI-powered code assistant showed that even complex questions regarding the legacy architecture can be successfully answered. This provides developers with significant guidance in poorly documented system areas, shortening onboarding time and sharpening their understanding for the mainframe replacement.

Furthermore, the project acted as a key catalyst for the company's AI strategy. The successful deployment of agentic AI and modern LLM architectures demonstrated the practical viability of these technologies in an enterprise environment and sparked further initiatives for modernization and automation.

Table of contents
Branche
Finance
Thema
Agentic AI
Code Understanding
Generative AI
Large Language Models (LLMs)
Semantic Search
Dauer
5 months
Share now
Link kopiert!
Dr. Jürgen Stumpp

Ready for the next step?

Let's find out together how we can support your business with customized AI.

Dr. Jürgen Stumpp
Managing Partner | AI Strategy Consultant
+49 170 9374842
Contact us