Choose by workload and failure

AI Integration Architecture Patterns

Choose synchronous, queued, event-driven, batch or workflow-based AI integration by decision latency, state ownership, recovery needs and operating capacity.

The right AI integration pattern follows the business decision window and the ownership of state. A short read-only suggestion can fit a request-response call. A document analysis that outlives the user session needs a durable job. A fact that several applications must consume may need an event. Treating all three as the same model API call hides the differences that determine reliability.

This guide is for solution architects and technical leads choosing how AI joins an existing application estate. It compares the boundaries and failure behaviour of common patterns rather than prescribing a particular cloud product. The result should be an architecture decision that can be tested through AI integration and delivery.

Start with five workload questions

First, how long can the person or downstream process wait for a useful result? Define this from the task, not from a model benchmark. Second, is the output advice, a proposed change or an authoritative business action? Third, which application owns the current state? Fourth, what happens if the same work arrives twice? Fifth, who can operate the recovery process?

Also distinguish throughput from response time. A system may process many records per hour while making individual users wait too long. Conversely, a quick interactive response may become expensive or unstable under a bulk upload. Document normal demand, bursts, the oldest acceptable pending job and whether low-priority work may be delayed.

Compare patterns at the business boundary

Architecture pattern decision matrix
PatternUseful whenRequired disciplineMain trade-off
Synchronous request-responseA bounded operation must respond during the current interactionDeadlines, bounded context, explicit errors and no ambiguous write retryDirect feedback, but caller availability is coupled to downstream latency
Asynchronous job with statusWork may continue after the user disconnectsDurable job identity, status, cancellation and result accessDecoupled execution, but more lifecycle and user-experience work
Event-driven consumptionSeveral consumers react to an already-established factEvent identity, schema, ordering, replay and consumer ownershipIndependent consumers, but delayed consistency and harder tracing
Scheduled batchThe decision remains useful at the next processing windowWatermarks, partial failure handling and reconciliationSimple scheduling, but results may be stale between runs
Durable workflowWork crosses approvals, waits and several application operationsPersisted state, transition rules, timeouts and recovery decisionsVisible coordination, but explicit process modelling is required
Adapter around an existing systemThe estate exposes an awkward or changing integration surfaceSemantic translation, compatibility tests and clear write ownershipProtects consumers, but adds a component that must be maintained

These are composable patterns. An API may accept a request, create a durable workflow, run a queued model task and publish an event after an approved application change. The architecture becomes confusing when those boundaries are implicit, not simply because more than one pattern is present.

Use synchronous calls for work with a credible deadline

A synchronous interaction is appropriate when the work is bounded and the caller needs the result immediately. Allocate a total deadline across authentication, retrieval, inference, validation and response delivery. Stop initiating new downstream work when the remaining budget cannot produce a useful result. A long chain of individually reasonable timeouts can exceed the user-facing deadline.

Prefer read-only or reversible preparation for the first interactive scope. If a call performs an authoritative change, define the outcome lookup and duplicate semantics before introducing automatic retries. Returning an error to the screen does not prove that a receiving system rejected the operation. The API-first integration guide makes that contract explicit.

When the deadline is routinely exceeded, do not simply increase every timeout. Consider whether the operation should become a job whose result the user can retrieve later. Explain what has been accepted and what remains unfinished instead of displaying an indefinite spinner.

Use a durable job when execution outlives the interaction

Microsoft's asynchronous request-reply pattern separates request acceptance from completion and provides a status resource. For an AI workload, the useful design implication is to preserve a job identity and observable lifecycle independently of the browser connection.

Define states such as accepted, running, awaiting review, succeeded, failed and cancelled according to the process. Cancellation needs its own semantics: stopping inference may be possible, while undoing an already accepted business action may require another authorised operation. Protect status and result endpoints with the same resource-level permissions as the original request.

Queues absorb bursts only while capacity and retention remain adequate. Specify backpressure: limit new work, prioritise classes, or offer a later service window. Track queue age and abandoned jobs. A durable queue is not a promise of timely completion, and an increasing backlog should not be mistaken for healthy acceptance throughput.

Publish facts as events and keep commands distinguishable

An event states that something happened; a command asks a particular capability to do something. “Inspection report approved” is a fact. “Create a billing review” is a request with its own authority and outcome. Naming both “process inspection” obscures whether consumers may reject work or whether the fact is already established.

Microsoft's event-driven architecture guidance describes decoupled producers and consumers. Apply that separation deliberately: consumers own their processing, and the producer should not claim all downstream work is complete when the event is published. Use event-driven AI integration for ordering, duplicate and replay mechanics.

Events can support several independent downstream views, but avoid turning a complex approval process into an undocumented chain of reactions. If a business owner needs to know which step is waiting and who can intervene, a durable workflow may provide clearer coordination. The event broker and workflow state serve different purposes.

A worked composition: field survey to a map-layer proposal

The following is an illustrative design. A mapping team receives georeferenced photographs and survey notes for updating descriptive features in an internal map. AI proposes feature labels and explains the supporting evidence. Survey coordinates remain authoritative; the model cannot determine legal boundaries, approve zoning or publish a new official map.

  1. The intake API validates the survey package identity and creates a durable job.
  2. Deterministic checks establish the declared coordinate reference system, required location fields and target map layer before model processing.
  3. A queued task interprets permitted survey notes and photographs, linking each proposed label to its source.
  4. A durable workflow waits for a map editor to resolve conflicts and approve a versioned change proposal.
  5. The authorised map application accepts the draft against the expected feature version and returns its reference.
  6. An event announces the accepted draft; a scheduled reconciliation checks that every completed job has a corresponding application reference.

The composition separates coordinate validation from language interpretation and keeps editorial approval visible. If the survey package omits its coordinate reference system, a fluent location description cannot repair that missing input. The case must pause for correction before proposed coordinates are used. A batch reconciliation can identify a valid proposal that never reached the map application without repeating the entire image-analysis task.

Now test a difficult sequence: an editor approves a label, but another authorised editor updates the same feature before submission. The destination rejects the stale feature version. The workflow should retrieve the current feature, preserve the rejected proposal and request a fresh comparison. It must not silently overwrite the newer change or publish an event claiming the original proposal was accepted.

If the receiving application accepts a later submission but its acknowledgement is lost, the workflow has a different problem: an unknown result rather than a known version conflict. It queries the operation identity and reconciles the existing draft. Keeping those states separate avoids using the same retry rule for two fundamentally different situations.

Use adapters to contain translation, not conceal uncertainty

An adapter can present a stable integration boundary while translating an existing application interface. Define what it translates: field names, identifiers, units, state values or authentication mechanism. Do not let it invent business meaning when two systems disagree. A missing equivalent state should become an explicit exception.

Microsoft's incremental migration pattern is relevant when routing moves gradually between old and new capabilities. Keep the owner of each write clear throughout coexistence. If the existing system is especially constrained, the legacy-system integration guide examines the adapter and transition boundary in more detail.

Record why the chosen pattern is the simplest adequate design

Write an architecture decision record with the workload, decision deadline, state owner, chosen pattern, rejected alternatives and remaining assumptions. Include a failure sequence and the evidence needed to demonstrate recovery. This makes the decision reviewable when demand changes or another team proposes a different technology.

Challenge unnecessary distribution. A small team may operate one modular service with a job queue more reliably than many independently deployed services. Use microservices for AI systems when ownership, scaling or release independence justifies the extra boundaries. Similarly, use agentic integration patterns only when dynamic tool choice adds value beyond a defined workflow.

For broader commercial context, Trusted Data's streaming architecture guide discusses event-processing workloads. Your own decision should still follow the required handover and the evidence your operators can maintain.

Discuss an AI integration architecture decision with a workload example, its acceptable delay, authoritative state and the failure sequence the design must survive.

FAQ

Your questions, answered.

When should an AI integration use a queue instead of a synchronous API call?

Use a durable job when the work may exceed the interaction deadline, must survive disconnection or needs controlled handling of bursts. Provide status, ownership and a result retrieval path. A queue alone does not guarantee completion time; capacity, prioritisation, expiry and recovery still need design. Keep synchronous calls for work whose bounded response is useful within the caller deadline.

Can one AI integration use APIs, events and batch processing together?

Yes, when each boundary has a distinct purpose. An API can accept work, a queue can execute it, a workflow can coordinate review, an event can announce an accepted fact and a batch can reconcile gaps. Document which component owns each state and what each acknowledgement means. Combining patterns is reasonable when it clarifies responsibility rather than hiding it.

What is the difference between an event and an AI tool command?

An event reports an established fact, while a tool command requests an operation that may be authorised, rejected or fail. Give them different contracts and names. Publishing an event does not prove every consumer completed its work, and generating a command does not mean the requested business change occurred. Both need identity and traceable outcomes appropriate to their role.

When is batch AI integration the better architecture?

Batch is appropriate when the business decision remains useful at the next scheduled window and immediate reaction is unnecessary. Define the included population, progress watermark, late arrivals, partial failures and rerun behaviour. It can also support reconciliation beside an interactive or event-driven workflow. Choose it from the decision deadline, not from an assumption that real-time processing is always superior.

Do all AI integrations need microservices?

No. Start from ownership, deployment independence, workload scaling and recovery needs. A modular application with a durable job mechanism may be sufficient. Separating components into services introduces network failure, contract management and operational overhead. Adopt that separation where the benefits are concrete and the team can operate the resulting boundaries.

What should an AI architecture decision record include?

Record the workload, decision deadline, authoritative state, selected pattern, alternatives, assumptions and a representative failure sequence. Identify the owners of retries, reconciliation and intervention. State what evidence would justify revisiting the decision, such as a changed workload or new interface capability. This makes the architecture explainable beyond the initial design meeting.

LET’S WORK TOGETHER

Ready to build what’s next?

Tell us about your project or the platform you want to explore, and we’ll come back to confirm a suitable time.