Home / Insights / Architecture and Modernization

Architecture and Modernization

Connecting AI to Legacy Systems: Integration Patterns That Avoid a Rewrite

Most valuable business data lives in systems built long before AI. This guide shows how to expose that data and functionality safely to AI features through facades, anti-corruption layers, events and change data capture — and how to choose an approach for each system.

TopicsArchitecture and ModernizationAI and Machine LearningBusiness Operations and Integration

Key takeaways

  • You rarely need to replace a legacy system to use AI with it. A well-designed integration layer can expose the data and actions AI features need.
  • Put an API facade and an anti-corruption layer between AI components and legacy systems, translating old data models into clean, documented contracts.
  • Use change data capture or events to feed AI features with fresh data without loading the legacy system with queries.
  • Choose the API style by consumer and constraint: REST for most integrations, gRPC for internal high-throughput calls, events for change notifications; keep SOAP and file interfaces behind adapters.
  • Treat the legacy system as fragile: rate-limit, cache, test against realistic data and never give AI agents direct write access.

The systems that hold most companies’ critical data — ERPs, core banking, policy administration, warehouse management, bespoke line-of-business applications — were built long before language models. They often lack modern APIs, use cryptic data models and are maintained by small teams who are wary of change. Yet AI features need exactly the data and actions these systems hold.

The good news is that a rewrite is rarely necessary. This guide covers integration patterns that let AI work with legacy systems safely. For broader guidance on adding AI to an existing product, see our guide to adding AI to an existing application.

What AI features need from legacy systems

  • Read access to current data: customer records, orders, policies, stock, transactions.
  • Historical data: for analytics, model training and retrieval.
  • Controlled actions: creating a ticket, updating a status, placing a hold — usually few and well-defined.
  • Change notifications: knowing when something changes, so AI outputs stay current.

Each has a different integration answer.

Integration patterns

PatternWhat it doesBest forWatch out for
————
API facadeA modern API in front of the legacy system, calling its existing interfaces or database viewsExposing selected reads and actions to new consumersMust not bypass legacy business rules on writes
Anti-corruption layerTranslates legacy data models and codes into a clean domain modelKeeping legacy quirks out of AI prompts and new servicesNeeds domain knowledge; can become a bottleneck if not owned
Change data capture (CDC)Streams database changes from logs into events or a data platformFresh data for analytics, search indexes and AI retrievalRequires database access; schema changes must be handled
Event publicationLegacy system or its facade emits business eventsTriggering AI workflows when things happenOlder systems may not support it without changes
Batch exportScheduled files or extractsHistorical data, model training, systems with no other interfaceData latency; file format drift
UI automation (RPA)Software operates the legacy user interfaceLast resort where no API or database access existsFragile, slow, hard to secure; plan to replace

Most integrations combine a facade for live reads and actions with CDC or batch feeds for data.

The anti-corruption layer matters more with AI

Legacy data models often use abbreviations, overloaded fields and status codes that only long-serving staff understand. If those leak into prompts and tool definitions, language models misinterpret them. An anti-corruption layer — a term from domain-driven design — translates them into clear names and values: STAT_CD = 7 becomes status: “awaiting_customer_documents”. This makes AI tools easier to describe, reduces errors and isolates the AI layer from future changes to the legacy system.

Choosing an API style

StyleUse whenNotes for legacy integration
———
REST over HTTP with JSONMost integrations, especially for AI tools and web clientsEasy to document with OpenAPI; widely supported by agent frameworks
GraphQLMany consumers need different views of related dataUseful as a facade over several systems; protect against expensive queries
gRPCHigh-throughput internal service callsEfficient but less convenient for external or AI tool use
Events and messagingChange notifications and asynchronous workflowsDecouples AI processing from legacy response times
SOAP or proprietary protocolsExisting legacy interfacesWrap behind a facade rather than exposing to new consumers

The facade can speak a modern style even when the system behind it does not.

Protecting the legacy system

Legacy systems are often sized for their original workload. AI features can multiply query volumes, especially agents that call tools repeatedly.

  • Rate-limit and queue calls from AI components.
  • Cache reference data and slow-changing records in the facade.
  • Serve reads from replicas or the data platform where freshness requirements allow.
  • Use CDC rather than polling to detect changes.
  • Keep writes narrow: a small set of well-defined commands that go through the legacy system’s own business logic, never direct database updates.
  • Monitor latency and error rates of legacy calls separately and set circuit breakers.

Security and compliance

  • Give AI components their own service identities with least-privilege access to the facade, not credentials for the legacy system itself.
  • Filter data by the end user’s permissions before it reaches a model.
  • Mask or omit personal data the AI feature does not need.
  • Log every call with user, purpose and data returned, for audit and data-protection obligations.
  • Check data residency: legacy data sent to an external model provider may be subject to contractual or regulatory limits.

Worked example: claims assistant for an insurer

A hypothetical insurer wants an assistant that helps claims handlers summarise a claim and draft next steps. Claims live in a 20-year-old policy administration system with a database and a SOAP interface.

  1. Facade: a REST API offers four read operations — claim summary, policy cover, payment history, correspondence list — and one write: add a note to the claim.
  2. Anti-corruption layer: translates claim status codes, cover codes and party roles into readable values.
  3. CDC: streams claim and correspondence changes into a search index used for retrieval.
  4. AI layer: the assistant calls the facade as tools, retrieves documents from the index and drafts a summary for the handler.
  5. Controls: read access is scoped to claims assigned to the handler’s team; the only write is adding a note, which the handler confirms.

The legacy system is untouched apart from read-only database access for CDC and the existing SOAP calls behind the facade.

Testing the integration

  • Contract tests on the facade so changes to the legacy system that break the translation are caught immediately.
  • Realistic test data copied and masked from production, because legacy data contains edge cases no synthetic set anticipates.
  • Load tests that simulate AI traffic patterns — bursts of tool calls — against a production-like legacy environment.
  • Failure tests for timeouts and unavailability, confirming the AI feature degrades gracefully rather than retrying aggressively.

A phased plan

  1. Map the use case to the data and actions it needs.
  2. Assess each system: available interfaces, database access, load capacity, data quality, owners.
  3. Build the facade and anti-corruption layer for the minimum set of operations.
  4. Add data feeds with CDC or batch for retrieval and analytics.
  5. Pilot read-only AI features, then add narrow write actions with confirmation.
  6. Use the facade for future modernisation: once consumers depend on the facade rather than the legacy system, the system behind it can be replaced piece by piece — the strangler fig approach Martin Fowler described in 2004.

Frequently asked questions

Can AI agents use the legacy system’s user interface directly?

Computer-use and RPA tools can, but they are slow, fragile and hard to secure. Use them only as a temporary bridge where no API or database access exists.

Do we need to clean legacy data before using AI?

For the fields the use case depends on, yes. Translate and validate them in the anti-corruption layer, and fix the most damaging quality problems at source.

Will integrating AI slow down the legacy system?

It can if AI components query it directly and repeatedly. Caching, replicas, CDC and rate limits protect it.

Is this a step towards replacing the legacy system?

It can be. A facade that consumers depend on lets you replace the system behind it gradually, without changing every consumer.

Sources and methodology

Facts in this article were checked against the sources below on 6 November 2026. Directory data (ratings, review counts, rate bands and team sizes) changes over time and is shown as published on the date accessed. Illustrative examples are labelled as such and are not quotes.

  1. Martin Fowler: Original Strangler Fig Application (29 June 2004) — accessed 6 November 2026. Gradually replacing a legacy system by building a new one around it
  2. Debezium documentation: Architecture — accessed 6 November 2026. Change data capture from database transaction logs

Want AI features on top of older systems?

Share your systems and the AI use case. We will help you choose integration patterns that are safe, testable and do not require a risky rewrite.