# Integration architecture for the AI era

> Enterprise APIs were written for programs whose behavior was fixed when they were built. Models and agents decide what to call at run time, so contracts, permissions and limits have to carry more of the weight.

Systems integration · Whitepaper · November 16, 2026 · 13 minute read · By Nabil Ahmed
Canonical: https://farside.works/insights/integration-architecture-for-the-ai-era/

![The lunar surface near 25°S, 139°W, lit by a low Sun with night falling across one side.](https://farside.works/content/images/2026/11/integration-architecture-for-the-ai-era.webp)

Integration architecture has always assumed that an API is consumed by a program a developer wrote. The developer read the documentation and wrote a fixed sequence of calls that, once tested and deployed, did the same thing every time it ran.

A model consumes an interface differently, because it reads a description of the interface at run time and decides for itself which operation to call and with what arguments, and whether to try again after a failure.

We do not think this calls for a new integration stack, only for the existing disciplines applied more strictly plus one new layer that presents enterprise operations to models as tools. Properties that used to count as good practice, such as idempotent writes, explicit contracts and identity carried through to the system of record, become requirements, because no developer is there any more to make up for their absence.

## In brief

- A model reads an interface's description at run time, so that description now shapes behavior and has to be versioned and tested as carefully as code.
- Agents should reach systems of record through a tool layer of narrow, business-level operations rather than through raw access to existing APIs or databases.
- The identity of the person an agent acts for has to reach the system of record on every call, because otherwise the agent becomes a way around the access model.
- Every write an agent can perform needs to be idempotent, because a model and its runtime retry more often and less predictably than hand-written clients do.
- Agent traffic needs budgets per task and per agent on top of limits per client, because one agent run can produce a burst of calls no human user would.

## What changes when the consumer is a model

Five differences drive the design.

**A model discovers the interface at run time.** It picks an operation by reading its name, description and parameter schema, so a vague description leads to wrong calls, and editing a description changes the agent's behavior without any code change on the consumer side.

**Call patterns are not fixed.** An agent, unlike a hand-written client, may call a search operation a dozen times with slightly different filters, page through an entire result set, or call operations in an order that nobody anticipated.

**A model decides for itself when to retry.** A coded client follows a retry policy, but a model that gets an error may retry at once, change the arguments or switch to another operation with a similar effect.

**Data can act as an instruction.** A model may read a text field as guidance, so free text returned by one system, such as a customer note, can change what the agent does next, and that is prompt injection.

**The caller's identity is layered.** There is the agent, the application hosting it and often a person it acts for.

Consider a mid-size manufacturer that exposes its ERP order API to an internal assistant so sales staff can ask about order status. The API was built for the web portal, with a `GET /orders` endpoint that takes optional filters and returns large pages, called through a single service account that can see every customer.

Three problems then appear. Asking "which orders are late" makes the assistant page through the whole order table, tripping the ERP's rate limit for the portal as well, since both share one client identity. A salesperson who asks about a customer outside their territory gets an answer, because the service account can see everything. A later version of the assistant is given an "update delivery date" operation and changes the same order twice after a timeout. In each case the ERP API works as designed, for a different consumer.

## Design principles

**Present business operations to the model.** Models work best with a few operations that each mean one business thing, so expose "get order status" and "list late orders for my accounts" in place of a generic query endpoint with fifteen optional parameters.

**The contract acts as the control.** A model will eventually send anything the schema allows, so constrain types, ranges and enumerations in the contract and validate on the server.

**Identity travels to the system of record.** The system that owns the data decides access using the identity of the person being served, which the layers in between pass through.

**Assume any call may be repeated.** Design writes so a repeat does no harm and reads so a repeat costs little.

**Put bounds on the consumer.** Limits on results per call, calls per task and cost per period are part of the interface and are designed with it.

**Treat returned content as untrusted.** Text passing through a model from one system to another has crossed a trust boundary and must never widen what the agent may do.

**Keep one trace across the whole path.** A request that starts with a user and passes through a model to three systems must be followable as one thing.

## The reference architecture

```
 People and applications          Autonomous agents
            \                         /
             v                       v
        +---------------------------------+
        | Agent runtime and model gateway |
        +---------------------------------+
                       |
                       v
        +---------------------------------+     +--------------------+
        | Tool layer                      |<--->| Identity and       |
        | business operations, schemas,   |     | policy             |
        | validation, idempotency keys    |     | token exchange,    |
        +---------------------------------+     | authorization      |
                       |                        +--------------------+
                       v
        +---------------------------------+
        | API gateway                     |
        | authentication, quotas, routing |
        +---------------------------------+
            |            |            |
            v            v            v
          ERP          CRM       Data platform
            |            |            |
            +------------+------------+
                         |
                         v
        +---------------------------------+
        | Event backbone                  |----> agent triggers,
        | business events, schemas        |      search indexes
        +---------------------------------+

 Contract registry and tracing span every layer.
```

| Component | Responsibility | Must guarantee |
| --- | --- | --- |
| Tool layer | Presents business operations to models and maps each one to one or more API calls | Arguments validated against a schema; writes carry an idempotency key; results limited in size |
| Identity and policy | Exchanges tokens and evaluates authorization on each call | The end user's identity reaches the system of record; an agent never goes beyond the user's access |
| API gateway | Authenticates clients, applies quotas, routes | Agent traffic is identified separately and cannot starve other consumers |
| Systems of record | Own the data and the business rules | Final access decision; deduplication of repeated writes |
| Event backbone | Carries business events from systems of record to consumers | At-least-once delivery, a stable event identifier, a published schema |
| Contract registry | Stores API, event and tool definitions with versions and owners | No breaking change reaches a consumer without a version change |
| Tracing | Correlates a request across model, tool, API and event | Any action can be traced back to the request and identity behind it |

Most enterprises already run the gateway and the systems of record, often with an event backbone, so the tool layer is the new piece, and it fits with the teams doing [systems integration](https://farside.works/services/software-engineering/systems-integration/) rather than in a separate AI group.

## APIs as tools

A tool is an operation offered to a model, defined by a name and a natural-language description along with a schema for its inputs. The Model Context Protocol is an open protocol that standardizes how model applications describe and invoke such tools. Its scope is covered in [what MCP standardizes, and what it leaves to you](https://farside.works/insights/mcp-what-it-standardizes/).

Generating one tool per endpoint from an OpenAPI document works for a demo, but existing APIs are shaped for developers as resource-oriented endpoints with many optional parameters, and a model given forty such tools picks the wrong one more often and chains more calls to do one job.

Tools work better when designed like an API product for a consumer whose habits you know:

- **Each tool serves one business intention.** Offer `get_order_status(order_number)` in place of a general order query.
- **Descriptions say when to use the tool and when not to.** Review changes to that text like changes to code.
- **Schemas are kept tight.** Use enumerations for status values, formats for identifiers and maximums for ranges, because a date range parameter with no maximum invites the model to scan everything.
- **Results are bounded and summarized.** Return only the fields the task needs, with a row cap and a clear signal when more exist.
- **Errors tell the model what to do next.** They should state what was wrong and what a valid value looks like, and distinguish "invalid argument", "not permitted", "not found" and "temporarily unavailable, do not change the request".

The manufacturer fixes its paging problem with a new operation, `list_late_orders(account_scope, limit)`, backed by a query the ERP team wrote and indexed.

This is ordinary [API design](https://farside.works/services/software-engineering/api-engineering/) work with one more consumer persona, and the tool layer should belong to the people who own the APIs underneath it.

## Permission pass-through

Permission pass-through means that the end user's identity is carried through every layer to the system of record, which then applies that user's permissions. The usual alternative, a shared service account for the agent, is the most common serious flaw in early AI integrations, because it makes the agent a confused deputy, a component with broad authority that can be induced to use it for someone who has less.

The standard mechanism is token exchange, defined in OAuth 2.0 Token Exchange (RFC 8693). The user signs in with the identity provider as usual, and the agent runtime presents the user's token together with its own credentials to the authorization server, which returns a new token scoped to the downstream API that names the user as the subject and the agent as the actor.

Three design points follow.

**The system of record makes the decision.** Territory rules, record-level sharing and field-level restrictions already live in that system, and reimplementing them in the tool layer creates a second copy that will drift away from the first.

**Agents get narrower scopes than their users.** A user may be allowed to delete an account when their assistant should not be, so the exchanged token carries only the scopes the agent's tools need.

**Retrieval follows the same rule.** If content is copied into a search index for retrieval, the index has to filter by the user's permissions at query time, since otherwise the copy goes around the control that the source system enforces.

Autonomous agents with no user present get their own service identity, scoped to one job.

## Rate limiting and budgets

Rate limiting restricts how many requests a consumer may make in a period, and the usual HTTP signal is status code 429 (Too Many Requests), often with a `Retry-After` header saying how long to wait.

Agent traffic arrives in bursts, since one question can fan out into dozens of calls within seconds, and it is correlated, because agents that hit the same slow dependency retry together, so the architecture needs limits at three levels.

| Level | What it limits | Where enforced | Why |
| --- | --- | --- | --- |
| Per client | Requests from agent traffic as a class, separate from the portal and batch jobs | API gateway | Keeps agents from starving other consumers |
| Per agent and user | Calls by one agent for one user in a period | Tool layer | Keeps one conversation from using up the shared allowance |
| Per task | Total tool calls, tokens and elapsed time for one run | Agent runtime | Ends runaway loops |

The per-task budget has no equivalent in classical integration, and it is the limit that catches a model stuck in a retry loop, because once the budget runs out the run stops and reports that it could not finish.

The tool layer should also respect `Retry-After`, back off with jitter and use a circuit breaker so a failing backend is left alone to recover. Concurrency limits on expensive operations protect systems such as an ERP that were sized for use at human pace.

## Idempotency and safe writes

An operation is idempotent if performing it several times has the same effect as performing it once, and the general mechanics are explained in [idempotency: the property that stops integrations doing things twice](https://farside.works/insights/idempotency-explained/). Agents raise the stakes for three reasons, which are that the runtime retries on timeouts, that the model may decide to retry by itself, and that a resumed run may repeat a step whose result was never recorded.

The tool layer should follow these rules:

- **Every write tool sends an idempotency key.** The runtime generates it per step and keeps it stable across that step's retries, and the model never sees it.
- **The receiving system records the key with the business change.** It does so in one transaction, and returns the original result when a key is repeated.
- **Writes that set a state are preferred.** "Set delivery date to the 14th" can safely be repeated, whereas "push delivery date back two days" cannot.
- **Semantic duplicates are caught as well.** A model may repeat an action with slightly different arguments under the same step or a new one, so where it matters add a business-level check, such as one open credit request per invoice or one delivery date change per order per run.
- **High-impact writes are proposed, then committed.** The tool creates a draft or pending change that a person, or a second policy check, commits.

The manufacturer's delivery date tool gets a key derived from the run and step, which the ERP integration service stores in the same transaction as the update, so a timeout and retry now yield one change and one audit entry.

## Events and data contracts

An event is a record, published for other systems to consume, that something happened in a system. Models and agents meet events in two ways.

As a trigger, an event starts an agent run when a dispute is opened or a shipment is delayed, for instance, which is sounder than polling. Most brokers deliver at least once, so triggers are deduplicated by event identifier or the same dispute is handled twice, and since events can arrive out of order, the agent fetches current state from the system of record before acting instead of trusting the payload.

As a feed, events keep derived stores such as search indexes, vector stores and caches current for models to read, and change data capture, which publishes row-level changes from a database log, is a common source. The freshness of what a model retrieves then depends on this pipeline, as does the removal of data deleted at the source. The wider costs are set out in [event-driven architecture: what it gives you and what it costs](https://farside.works/insights/event-driven-architecture-tradeoffs/).

A data contract is a written, versioned agreement between the producer of data and its consumers about structure, meaning and quality. With coded consumers a breaking schema change usually fails loudly because a parser throws an error, but a model tends to carry on, so if `net_amount` is renamed to `amount` and its meaning changed to gross, the model will keep reading the new field and producing confident answers that are wrong.

Contracts for AI consumers therefore cover more than structure:

- **Semantics are written down.** That covers units, currency, time zone, what null means and what each status value means, and field descriptions belong in the contract because the model reads them.
- **All three kinds of interface are versioned.** Use OpenAPI for HTTP APIs, AsyncAPI or a schema registry for events, and a versioned definition for each tool that includes its description text.
- **Compatibility rules are enforced in the pipeline.** A change that removes a field, narrows a type or alters a meaning requires a new version.
- **Evaluation works as contract testing.** Any change to an API or tool definition triggers the regression suite of the AI systems that consume it.

Contract ownership is part of [data strategy and governance](https://farside.works/services/data-analytics/data-strategy-governance/), and the approach is described in [data contracts: keeping an AI system's inputs from moving](https://farside.works/insights/data-contracts-for-ai/).

## Observability

When an agent reaches a wrong outcome, the cause could lie in the model's choice or the tool's mapping, or in the API's response and the data behind it, and observability has to show which.

It rests on context propagation, for which the W3C Trace Context specification defines a `traceparent` header that carries a trace identifier across service boundaries, and OpenTelemetry provides open instrumentation that implements it, so the agent runtime starts a trace for each run and every model call, tool call, API request and published event carries the same identifier.

Beyond latency and errors, each tool call should record:

- the run, the agent, the end user and the tool version;
- the arguments, with sensitive fields redacted;
- the authorization decision and the idempotency key;
- the size of the result and whether it was truncated;
- for model calls, the model version and the token counts.

Operations staff watch calls per run, retry rates per tool and budget exhaustion, where rising calls per task often signal that a description or model version has changed behavior. Security watches denied calls by agent and user, and system owners see agent traffic as a distinct consumer of their APIs.

Audit logs in the systems of record should show both the user and the agent for each change, since a log that only says "integration user" means pass-through has not reached the place where it matters.

## Trade-offs and failure modes

**A tool layer is one more layer to own.** A thin wrapper is enough for one read-only assistant over one system, and the full design pays off once there are writes or several systems and agents.

**Curated tools limit what agents can do.** Someone has to build a tool before an agent can use a new capability, which is slower than exposing everything, although the backlog of tool requests becomes a visible record of what agents are allowed to do.

**Pass-through runs into legacy systems.** Older systems with a single integration user cannot honor per-user identity, and compensating controls in the tool layer are weaker and should be documented as such.

Test these failure modes before launch:

- **Enumeration is stopped by caps and budgets.** Ask a broad question and confirm that result caps and task budgets prevent a full table scan.
- **A retry storm stays contained.** Slow a backend down and confirm that backoff and circuit breakers hold and other consumers keep their quota.
- **Privileges do not leak.** As a restricted user, ask for data outside your access through live tools and through retrieval.
- **A duplicate write has a single effect.** Force a timeout after the backend commits and confirm that only one change results.
- **Injected content cannot widen scope.** Put directive text into a record the agent reads and confirm it cannot cause a call outside the user's scope.
- **A silent contract change is caught.** Change a field's meaning in a test environment and confirm that the regression suite fails.

## Adoption path

1. **Inventory how models reach your systems today.** List every assistant, agent and AI feature with the APIs and identity each one uses, and put shared service accounts at the top.
2. **Separate agent traffic at the gateway.** Give it a client identity and a quota of its own.
3. **Fix identity for one path.** Implement token exchange for the most used assistant through to one system of record.
4. **Build a small tool layer for one domain.** Start with five to ten read operations designed around the tasks people actually ask about, with schemas, result caps and structured errors.
5. **Add writes one at a time.** Each gets an idempotency key, a duplicate test and, at first, a propose-then-commit step.
6. **Propagate trace context through every layer.** Carry it from the agent runtime through the tools and the APIs.
7. **Register contracts and wire up the checks.** Tool definitions, API specifications and event schemas go into one registry, with compatibility checks and regression suites triggered whenever something changes.
8. **Move suitable triggers to events.** Do this once the backbone and deduplication are in place.

The first three steps are covered in more depth in [connecting AI to systems of record: patterns that survive production](https://farside.works/insights/connecting-ai-to-systems-of-record/). Who owns the tool layer across the company is a question for [enterprise integration](https://farside.works/services/process-automation/enterprise-integration/) as a capability, while connecting particular models to particular systems is the work of [AI integration](https://farside.works/services/artificial-intelligence/ai-integration/).

Four questions are worth putting to your integration and AI teams this week. Which identity does each AI feature use when it calls a system of record? What happens if a model calls our most sensitive write operation twice? Can agent traffic use up a quota that a customer-facing application depends on? If an API team renames a field tomorrow, which AI systems would start giving wrong answers, and how would we find out?
