Connecting AI to systems of record: patterns that survive production

An AI feature is only as useful as its connection to the ERP, the CRM and the core platforms, so treat the model as an untrusted caller that gets narrow tools, the user's own permissions, validated writes and a record of every call.

By Nabil Ahmed8 minute read

The lunar surface near 12°N, 29°W, lit by a low Sun with night falling across one side.
The Moon near 12°N, 29°W. Rendered by Farside from NASA Lunar Reconnaissance Orbiter elevation data.

In a demo, an AI feature usually reads from a spreadsheet export and answers well. The production version has to read from a policy administration system or an ERP or core banking platform, with real permissions and volumes, while that system carries on with its normal work. Most of the engineering effort lies in that connection, although it rarely gets the attention.

A system of record holds the authoritative version of a piece of business data, as the ledger does for balances or the policy system for cover, and the HR platform for employment. Such systems were built for trained users and predictable integrations, and a language model is neither. It will sometimes call a tool with arguments that look plausible but are wrong, repeat a call it has already made, or act on instructions it found inside a document it was asked to summarize.

We recommend designing the connection as though the model were a very capable but untrusted external caller, so everything it can read or change passes through a narrow, typed interface that enforces the rules, and deterministic code decides whether each proposed action is allowed.

In brief

  • A language model should reach a system of record only through narrow, typed tools that enforce business rules in code, and never through open query access or a shared administrator account.
  • The AI feature should act with the permissions of the person using it, so it can never show that person anything, or change anything, beyond what they could reach directly.
  • Every write that a model initiates needs server-side validation and an idempotency key, because models repeat calls and frameworks retry them.
  • Read traffic from AI features should be limited and, where freshness allows, served from a replica or an indexed copy, which protects the system of record from load it was not sized for.
  • A record of every tool call, with the acting user, the arguments and the result, is what lets you explain an AI-driven change to an auditor or a customer.

The patterns at a glance

Pattern What it prevents Where it is enforced
Narrow, typed tools Wrong or invented queries, access to unintended data Tool layer in front of the system
Identity pass-through Users seeing or changing data beyond their own entitlement Identity provider and the system's own access control
Deliberate freshness Stale answers presented as current, overload of live systems Choice of live call, replica or index per tool
Validated, idempotent writes Invalid changes, duplicate changes Tool layer and the system's own API
Limits and budgets A loop or a busy hour degrading the core system Gateway or tool layer
Tool-call audit Changes nobody can explain afterwards Tool layer, written to durable storage

The six patterns in detail

Pattern 1: narrow, typed tools in place of open access

Letting a model write SQL is the quickest way to connect it to a database, and also the quickest way to get a confident answer computed from the wrong join or a query that scans the largest table at midday, along with a path by which crafted text in a record can cause data to be read out.

The model should get tools that match business questions and actions, such as getting a policy by number, listing open claims for a customer or recording a note on a claim. Each tool has typed parameters and a description of when to use it, along with a bounded result size and a fixed implementation that the model cannot alter. The tool calls the system's supported API rather than its tables, so the system's own validation continues to apply.

Keep the set small, because each tool is another surface you have to secure and test, which follows the principle argued in give the agent one job, and only the keys it needs. Protocols such as the Model Context Protocol standardize how tools are described and called, but they leave the decision about what your tools may do to you, as discussed in what MCP standardizes, and what it leaves to you.

Tool results need the same care as inputs, because text that comes back from a system of record, such as a customer's free-text message or an uploaded document, may contain instructions aimed at the model. Returned content should be handled as data, and no tool result should be able to widen what the model is permitted to do.

Pattern 2: act as the user and avoid a shared service account

The usual shortcut is one service account with broad read access that every user of the feature shares, after which the AI layer has to re-implement the system's permission model to filter what each user may see, and it usually gets this wrong, which first shows up as an employee reading something they should not.

With identity pass-through, the AI feature calls the system of record as the signed-in user, using a token for that person, and the system applies its own access rules. The OAuth 2.0 on-behalf-of and token exchange flows were designed for this where systems share an identity provider. Where an older system cannot accept a user token, the tool layer must apply the user's entitlements explicitly, fetched from the system that owns them, and that mapping needs its own tests.

Pass-through has two limits. It controls what can be reached but not what should be done, so a user with authority to cancel a policy can still be badly served by an assistant that cancels the wrong one. Any content indexed in advance for search also has to carry its permissions into the index, or retrieval becomes a way around access control. Both issues are central to AI integration work.

Pattern 3: decide freshness per tool

Many questions can be answered without the live system, so decide for each tool and write the decision down.

  • Live call for anything where a stale answer would be wrong in a way that matters, such as an account balance, a stock level before a promise is made to a customer, or the current status of a claim.
  • Read replica or operational data store for lookups that can tolerate a short delay and would otherwise add load to the transactional system.
  • Search index for unstructured content like policy wordings and procedures, or correspondence, refreshed on a known schedule.

Whichever option is chosen, the answer should state its age. A tool result that includes the time the data was read lets the application say the figure is "as of this morning's load", which is accurate and heads off a whole category of complaint.

Pattern 4: writes are proposals until code accepts them

A model's request to change something is a proposal. The tool layer checks it against rules the model cannot argue with, confirming that the record exists, that the user may change it, that the value is in range and that the state transition is legal, and any rejection goes back to the model as a structured error it can act on.

Three further rules make writes safe to operate.

  1. Every write carries an idempotency key. Models re-issue calls and agent frameworks retry on timeout, so without a key a retried "create payment" becomes a second payment. The mechanism is explained in idempotency: the property that stops integrations doing things twice.
  2. Reversible operations come first. A draft, a pending change or a note can be undone, so the first release should be designed around operations of that kind, with irreversible actions added only when the evidence supports them.
  3. A person confirms consequential actions. Where money moves, a customer is notified or a record is closed, the proposed change should be shown and confirmed before it happens. Doing that without training people to click through is covered in designing human approval into agent systems.

Pattern 5: limits and budgets

Core systems are sized for people and scheduled integrations, while an agent in a loop can issue more calls in a minute than a team makes in a day.

Limits belong where the model cannot bypass them, as a cap on tool calls per conversation and a rate limit per user and tool, together with a concurrency limit toward each backend and a timeout on every call. When a limit is reached the tool returns a clear refusal, and the application tells the user what happened. Where the backend publishes its own rate limits, the tool layer should stay under them and back off when asked to, which is ordinary systems integration discipline applied to a new kind of caller.

Pattern 6: a record of every call

Each tool call should be recorded with the acting user and the tool, its arguments and its result or error, the time, and an identifier that links it to the conversation and the model version. The record should be stored somewhere durable and queryable, with the same care over personal data that the source system takes, so that when someone later asks why a record was changed there is an answer that does not depend on the model explaining itself.

A claims assistant at a regional insurer

Consider a regional insurer building an assistant for claims handlers, which is meant to answer questions about a claim, summarize the file and draft the next letter.

The first version works from a nightly extract of the claims system through one service account, and although it is fluent in testing, three things go wrong in the pilot. A handler asks about a claim that was updated that morning and gets yesterday's reserve figure. A handler in one region can retrieve another region's claims, including a restricted file involving an employee. When the team adds a "record file note" action, a timeout followed by a retry writes the same note twice on several claims.

The second version leaves the model as it was and changes the connection.

  • Status, reserve and payment questions go through a live get_claim tool on the claims system's API with the handler's own token, so the claims system itself refuses the restricted file.
  • Correspondence and policy wordings remain in a search index, with each document's access group stored alongside it and applied at query time, and answers state the date of the index.
  • add_file_note validates the claim number and the note length, requires an idempotency key derived from the conversation turn, and writes through the supported API.
  • Letters are created as drafts in the document system, and sending them remains the handler's decision.
  • Every conversation has a cap on tool calls, and each call is logged with the handler's identity.

The design is judged on measures the business already tracks: time to answer a status query, permission test cases passed, duplicate notes found and letters edited before sending.

What to do before you connect anything

  • For each use case, list the systems of record it touches and the supported API for each one, and if direct table access is the only route, solve that first as an API engineering task in its own right.
  • Write the tool list on one page, with each tool's name and parameters, whether it reads or writes and whether it is live or indexed, and who may call it.
  • Decide how the user's identity reaches each system, and write permission tests that use real role combinations, including the awkward ones.
  • For each write tool, define the validation rules and the idempotency key, and decide whether a person confirms the action.
  • Set limits per conversation, per user and per backend, and agree them with the owners of those systems.
  • Confirm where tool calls are logged, how long the logs are kept and who may read them.
  • Run the whole path against a production-sized copy under poor conditions such as a slow backend or an expired token or a malformed record, because the model's behavior on the unhappy path is what your users will remember and it is the part of agentic AI that a demo never shows.

Related services

Start a conversation.

A short paragraph is enough. A principal reads every message and replies within one working day.

Or email hello@farside.works. We use what you send only to reply. Privacy