AI on a Legacy System: A Read Layer Without Rewriting the Core

AI on a Legacy System: A Read Layer Without Rewriting the Core

How to add a read-only layer over a legacy system so AI can answer questions and draft outputs, with restricted permissions, logs and a controlled pilot.

•

Want to apply this in your company?

Book a call with Juan →

The safest way to connect AI to a legacy system without rewriting its core is to build a read layer: a separate component that queries existing data, organizes the context, and answers questions or prepares drafts without writing anything back to the old system. The legacy system remains the source of truth. The AI sits outside it with restricted permissions, and every query is logged. This separation lets you test real value on a small workflow before deciding on any deeper change.

Key takeaways

  • The read layer connects to the legacy system through paths that already exist, such as exports, read-only queries, APIs or documents. It does not replace the core.
  • Mapping the process and the data source comes before any technology choice.
  • Narrow read permissions and an explicit list of forbidden actions reduce risk more than any instruction written in a prompt.
  • Records of questions, sources used and answers give you the evidence to evaluate the pilot and fix what fails.
  • The decision to expand, adjust or stop should be made against a metric agreed before the pilot starts.

What a read layer over a legacy system is

Many businesses in Brazil run an old system that works: an ERP installed years ago, scheduling software built to order, spreadsheets that grew into systems. It does the job, but it holds the knowledge in a form that is hard to reach. Getting one answer can mean opening several screens, exporting a report, or asking the one person who knows how to use it.

A read layer solves part of this without touching what keeps the operation running. It collects the permitted data, normalizes what is needed, and delivers answers to people or to an AI agent. Writing still happens where it always happened, under the same rules and with the same people responsible.

This is not rewriting the system, and it is not placing AI inside it. The distinction matters for the decision maker: the risk of breaking billing, inventory or scheduling stays concentrated in one small, reversible point.

Map the process before choosing the data source

The most common mistake is starting with the tool. Before choosing anything, write down answers to a few questions about the workflow you want to support:

  • Which question or task repeats every day and currently takes someone's time?
  • Which data is needed to answer it, and where does that data actually live?
  • Which data is personal, sensitive or confidential, and who can see it today?
  • Which decisions can the AI only suggest, and which require human approval?
  • Who owns the process, and who checks that the answer is correct?

This mapping also sets your baseline. Without one, you will have no way to tell later whether the pilot improved anything. Note how long the task takes today, how often it comes back with errors, and which exceptions show up. It does not need to be a sophisticated analysis, but it has to exist.

How the read layer accesses the data

In general, there are four paths, each with different costs and risks. The right choice depends on what the legacy system offers and how much your IT team can support.

  • Scheduled export: reports saved as files, generated at a fixed time and loaded into a separate repository. It is simple and low risk, but the information arrives with a delay.
  • Replica or read database: a copy of the data in read-only mode, where the vendor or your team allows it. It gives reasonable freshness without touching production.
  • Existing API: if the system already exposes endpoints, use only those that serve the workflow, with its own read credentials.
  • Documents and policies: manuals, procedures, internal tables and written rules. For many support questions, this material is enough, and it is the least risky of all.

When the source is a screen with no API, interface automation can appear as a last resort. It is fragile, depends on visual changes in the system, and should be treated as a temporary solution that gets reviewed often.

Google Cloud's documentation on generative AI applications with retrieval augmented generation describes the pattern of finding relevant passages before answering, which is usually sufficient for a read layer. Before deciding what to standardize in these sources, read about data organized for superintelligence.

Limit what the AI can see and do

Limits work in layers. The first is the credential: the read layer should use its own user, with read-only permission, restricted to the tables or fields the workflow needs. Do not use a manager's account or an administrator key just to make the start easier.

The second is the tool set. If the agent can look up orders, it should not be able to change them. If it can suggest a rescheduling, the confirmation should pass through a person or a deterministic rule. The OWASP project maintains a list of risks for applications built on language models, including prompt injection and excessive permissions, and it works well as a review checklist.

The third is privacy. If the read layer brings in customer data, Brazil's LGPD applies: the purpose must be clear, access must be minimal, and the model provider must be identified. Depending on where processing takes place, international data transfer when using AI providers also enters the picture, and that is a decision for legal counsel, not only for the technical team.

Prompt instructions help, but they do not replace permissions. A sentence like "do not reveal other customers' data" is a request. A user who can only see their own customer's data is a technical guarantee. Prioritize the second.

Illustrative scenario: order status inquiries

Imagine a fictional packaging distributor running a sales system installed years ago. The support team receives many questions about order status, delivery dates and invoices. Today, each question requires a manual lookup across two screens.

In this illustrative scenario, the team builds a read layer that receives an order export at regular intervals, into a separate database with read-only access. An agent answers status and delivery questions based on that export, identifies the customer by registration number, and when a question involves cancellation, a quantity change or a deadline exception, passes it to a person with a short summary of the history. No answer touches the sales system.

The key point of the scenario is that the legacy system stays intact, and the team knows exactly what the AI read and what it answered. If the export is late, the agent should say the status may be out of date, rather than invent one.

Logs, evaluation and a pilot with an agreed metric

Before putting the layer into real use, build a set of test questions drawn from real support interactions, with expected answers reviewed by someone who knows the process. This set is the basis for evaluation, and it grows with every error you find. Anthropic has published material on evaluating AI agents, and the idea of repeatable tests applies regardless of the tool you choose.

A healthy pilot follows a clear sequence:

  • Record each query, the data read, the answer given and the handoff, with timestamps and an identifier for who received it.
  • Run the test set every time the prompt, the data source or the model changes.
  • Choose the success metric before starting, for example, how many status questions were resolved without handoff and with an answer the team verified.
  • Review the agent's errors and unnecessary refusals every week.
  • Decide in advance what happens if the metric is not reached: adjust the source, reduce the scope or stop.

Records are also protection. OpenTelemetry's introduction to observability explains how traces, metrics and logs let you understand a system's behavior from the data it produces, and the same logic applies to agents. Without records, you cannot investigate an error or show what happened.

To test the agent before exposing real customers, use simulated environments. The article on mock tools for testing AI agents explains how to do this without risk.

How the Juan Carlo method applies

In practice, we follow four steps: map the process and the baseline, limit data and actions to what is strictly needed, pilot a real workflow with records and an agreed metric, and then hand over the operation and decide whether to expand, adjust or stop. The read layer fits this sequence because it is small, reversible and easy to measure. When the operation starts depending on it, maintenance can be handled by Be Human (be-human.ai), always under permission and logging rules defined from the start.

When to expand, adjust or stop

At the end of the pilot, the decision should come from the data and the agreed rules, not from the impression of whoever liked the demo. A simple guide helps:

  • Expand when the metric was reached, errors are rare and explainable, and the team trusts the records.
  • Adjust when the metric landed close to the target, but errors cluster in one source or one type of question. Improve the source or narrow the scope before widening it.
  • Stop when the source requires fragile workarounds, when privacy cannot be guaranteed, or when the process changed and the gain disappeared.

Stopping is also a valid result. A pilot closed with clarity costs less than an integration kept alive out of obligation.

Frequently asked questions

Do I need to rewrite my legacy system to use AI? Not necessarily. A read layer can query exports, read-only replicas, existing APIs or documents without changing the core. The decision to rewrite should come after a pilot that shows where the real limitation is.

Can I give the agent write permission so it can act on its own? Generally not in the first phase. Actions that change orders, charges or schedules should go through human confirmation or a deterministic rule. Start with reading and suggesting, and expand only when the records support the decision.

How do I know whether the pilot worked? Agree on the metric before starting, using real questions and answers reviewed by someone who knows the process. Compare the results with the baseline from your mapping and review errors weekly. Without that comparison, a subjective impression is not enough.

What should I watch for with customers' personal data? Apply the principle of minimum necessary data, use credentials with restricted access, record the purpose of the processing and check LGPD requirements for the workflow. If processing involves services outside Brazil, confirm the transfer conditions before exposing real data.

Sources

legacy systemsAI agentsread-only accessAI pilotssystem integration