Enterprise AI integration is not one universal connector. A conversational read, a document-processing job, a cross-system workflow, and a production change require different communication, state, approval, and recovery patterns.
7.1 Pattern selection framework
Select a pattern from the business transaction. Determine whether the caller must wait, whether the task is long-running, whether a side effect occurs, whether order matters, whether multiple systems participate, and whether accountable human approval is required.
| Question | Preferred pattern |
|---|---|
| Fast, bounded read or validation? | Synchronous request-response |
| Long model or document-processing task? | Asynchronous request-reply or queue |
| One state change triggers independent reactions? | Publish-subscribe event integration |
| Known multi-step business process? | Durable workflow with bounded AI steps |
| Transaction spans independent systems? | Saga with compensation |
| Large or sensitive payload? | Claim check |
| Material business impact? | Structured human approval |
7.2 Synchronous request-response
Use synchronous calls for fast, bounded work
The caller waits for the result. Suitable examples include identity validation, permission checks, small read operations, classification, and generation of a non-binding draft.
The operation normally completes inside a predictable timeout.
Apply timeout, rate limit, schema, policy, circuit breaker, and trace ID.
Avoid for human approval, long agent loops, or multi-system writes.
If the operation can exceed the channel timeout, return an operation ID and continue asynchronously. A client timeout means the outcome is unknown, not necessarily failed.
7.3 Asynchronous request-reply
The caller submits work and receives an operation identifier. Processing continues independently, and the caller polls a status endpoint or receives a callback or event.
POST /ai/reviews
202 Accepted
{"operation_id":"op_88421","state":"queued","status_url":"/ai/operations/op_88421"}
GET /ai/operations/op_88421
{"state":"completed","result_uri":"/ai/reviews/op_88421/result"}Persist tenant, initiator, input hash, task class, agent version, retry count, expiry, and final outcome. This pattern is appropriate for document review, multimodal analysis, large retrieval jobs, and expensive evaluations.
7.4 Event-driven integration
Event producers publish facts such as “contract updated,” “incident opened,” or “payment failed.” Independent consumers react without the producer knowing which consumers exist.
Consumers must handle duplicate delivery, ordering, replay, eventual consistency, and schema evolution. Events describe facts; commands request actions. Do not use an event name to hide an ownerless command.
7.5 Queue and competing consumers
A queue buffers work and allows several consumers to process independent tasks concurrently. This pattern supports document extraction, embedding, classification, evaluation, and other bursty AI workloads.
| Issue | Required design |
|---|---|
| At-least-once delivery | Idempotent consumers and stable operation IDs |
| Poison messages | Dead-letter queue and owned remediation process |
| Ordering | Partition by business key only when sequence is required |
| Backpressure | Scale from queue depth while protecting model and target quotas |
| Tenant fairness | Quotas, priority classes, or isolated partitions |
7.6 Durable workflow with bounded AI steps
A workflow engine owns process state, timers, retries, branching, approval, and recovery. Models contribute bounded classification, extraction, reasoning, or drafting steps.
workflow: contract-review
steps:
- retrieve_contract
- extract_terms: {model_task: structured_extraction}
- validate_terms: {service: contract-policy-validator}
- risk_review: {model_task: grounded_reasoning}
- human_approval: {required_if: "risk_tier >= high"}
- create_legal_case: {capability: legal.case.create-draft}
- verify_resultBusiness state must remain valid if the model or agent framework changes. Conversation history is not a workflow database.
7.7 Saga and compensating transactions
A saga coordinates local transactions across independent systems. If a later step fails, compensating actions restore an acceptable business state.
Compensation is not always a perfect reversal. A sent communication or production action may require a new corrective operation and an accountable exception owner.
7.8 Claim check
Store a large or sensitive payload in a controlled data store and send only a short reference through the message channel. The consumer retrieves the payload with its own authorized identity.
Large files do not travel repeatedly through intermediaries.
The bus carries a reference rather than sensitive content.
Bind the token to tenant, purpose, expiry, and deletion policy.
7.9 Structured human approval
Approval is a workflow event tied to one exact action, resource, evidence set, risk tier, and expiry. If the action changes, the approval becomes invalid.
{
"approval_id":"ap_2201",
"operation_id":"op_44192",
"action_hash":"sha256:...",
"resource":"production:payments-api",
"decision":"approved",
"approver_role":"production_change_approver",
"expires_at":"2026-08-03T19:00:00Z"
}7.10 Retrieval and grounding
Retrieval supplies permission-filtered, current, source-linked enterprise context. It is appropriate when a model must use policies, contracts, records, or domain knowledge not reliably contained in model parameters.
| Control | Purpose |
|---|---|
| Permission-aware retrieval | Prevent unauthorized context from entering the model |
| Authority metadata | Distinguish system of record, approved policy, analysis, and summary |
| Freshness | Prevent stale evidence from driving current action |
| Source manifest | Reconstruct what evidence informed the result |
| Injection isolation | Prevent retrieved text from changing policy or tool scope |
7.11 Anti-corruption adapter
An adapter shields the AI platform from legacy protocols and inconsistent domain semantics. It maps old identifiers, status codes, errors, and transactions into a stable business contract.
Expose business meaning, not legacy mechanics
The adapter can translate “active customer,” validate target state, and invoke an existing transaction without giving the model raw database or terminal access.
7.12 Capability gateway
A capability gateway provides a governed tool boundary for agents and workflows. It validates agent registration, user and resource scope, policy, schema, quota, approval, idempotency, and audit rules before routing to a connector.
7.13 Fan-out, fan-in, and aggregation
Split a task into independent legal, financial, technical, or security branches, then aggregate the results. Preserve source evidence and disagreement. A blocking finding from one branch should not be averaged away by a general model.
7.14 Resilience patterns
| Pattern | Purpose |
|---|---|
| Circuit breaker | Stop repeated calls to an unhealthy model or connector |
| Retry with backoff | Handle transient failures without overwhelming dependencies |
| Bulkhead | Isolate tenant, agent, or workload failures |
| Dead-letter queue | Separate repeatedly failing work for investigation |
| Idempotent consumer | Make duplicate delivery safe |
| Cache-aside | Reduce latency while preserving tenant scope and freshness |
Resilience rule: retries are safe only when an operation is idempotent or its state can be reconciled.
7.15 Integration anti-patterns
| Anti-pattern | Why it fails |
|---|---|
| Long agent workflow behind one synchronous endpoint | Timeouts create unknown state and unsafe retries |
| Conversation history as workflow state | Restart, replay, approval, and recovery become unreliable |
| Raw target APIs exposed as tools | Business policy and verification are missing |
| Free-text approval | Action scope and accountable authority are ambiguous |
| Large documents copied into every message | Cost, latency, leakage, and broker pressure increase |
7.16 Pattern selection checklist
7.17 Chapter summary
Request-response serves fast bounded work. Asynchronous work and queues protect latency and scale. Events decouple business facts from reactions. Workflows preserve state. Sagas manage distributed side effects. Claim check protects large payloads. Human approval preserves accountable authority. Retrieval grounds decisions. Adapters and capability gateways isolate system complexity and apply governance.
Core conclusion: the right integration pattern is the one that matches the transaction’s latency, consistency, authority, and recovery requirements.
Reference foundations
- Microsoft Azure Architecture Center: event-driven architecture, competing consumers, claim check, saga, circuit breaker, and compensating transactions.
- AWS Prescriptive Guidance: asynchronous API and event-processing patterns.
- OpenTelemetry: distributed tracing for asynchronous and multi-service systems.
- AetherStaff Chapters 1–6: architecture, security, and threat-model foundations.