Service boundaries that earn their cost

Microservices for AI Systems

Decide which AI components need independent services using business ownership, scaling, release cadence and failure containment, with a worked decomposition review.

Microservices can help an AI system scale and evolve when components have genuinely independent ownership, workloads or release needs. They also create network boundaries, distributed state and more things to operate. The useful question is which boundaries deserve independent services, rather than how many services can be drawn around a model pipeline.

For a technical lead planning AI integration and delivery, service decomposition should begin with business capability and operational responsibility. Retrieval, inference and validation can be separate modules without immediately becoming separate deployments. A service earns its independence when the benefit is clear and its contract can survive failure.

Find the domain boundary before the technology boundary

Microsoft's microservices domain-analysis guidance describes using business capabilities and bounded contexts to identify service boundaries. Apply that idea to the meaning of records. A “case” in an operations queue may have different lifecycle and ownership from a model evaluation case, even though both use the same word.

Ask which team decides the valid state transitions, which records must change together and which capability can be deployed without coordinating every consumer. If two proposed services constantly require simultaneous changes and share the same database tables, their apparent separation may provide little practical independence.

Start with a domain map and the business invariants. For example, an approved work instruction must reference the exception case that justified it. Decide which component enforces that relationship. Dividing a workflow into small HTTP endpoints does not make cross-service consistency somebody else's problem.

A worked decomposition: collection-exception processing

The scenario is illustrative. A waste-collection operator receives field notes and photographs about collection exceptions. AI proposes a category and evidence summary. An operations coordinator decides the response, while the established dispatch application owns any resulting work instruction. The model does not make safety or disposal decisions.

The organisation initially has one application team and a modest workload. It can implement intake, interpretation and case management as clear modules in one deployable application. A later increase in image-processing demand may justify separating inference workers without splitting every part of the business process.

Illustrative decomposition review
CapabilityIndependent-service argumentReason to keep it together initially
Field-report intakeDifferent external clients and upload-capacity needsSmall controlled client population and shared release ownership
AI interpretation workersDistinct compute, concurrency and model-release requirementsLow volume and no independent operating team
Exception case managementBusiness lifecycle with its own users and authorityClosely coupled review and proposal state
Dispatch adapterExisting application compatibility and credentials require a stable boundaryA simple supported interface with limited consumers
Evaluation toolingIndependent offline workload and release evidenceCan remain a separate internal tool without becoming a production service

The table is a decision aid, not a prescribed topology. Document the trigger for separation: measurable queue pressure, conflicting release needs, a new owner or a requirement for a different security boundary. This makes future extraction a response to evidence rather than a commitment to speculative complexity.

Assign one authoritative owner to each record

The intake component owns receipt of the original field report. The interpretation component owns a versioned proposal, including the model configuration and source references. Case management owns review status and approved disposition. The dispatch application owns the accepted work instruction. These ownership rules must remain clear whether the components share a deployment or run separately.

A service should not quietly update another service's private tables to avoid an API limitation. That creates hidden coupling and can bypass validation. Use an agreed API contract or event interface and keep the authoritative application responsible for its own state transitions.

Shared reporting views can be derived from events or read interfaces, but label their freshness. A dashboard projection is not automatically suitable for deciding whether a work instruction may still be changed. When current state matters, consult the authority or use a defined version precondition.

Make consistency a workflow decision

Suppose case management records an approved follow-up, but the dispatch application is temporarily unavailable. Decide whether the case is approved-awaiting-dispatch, submitted or confirmed. Do not mark it complete merely because a local transaction succeeded. The business owner should be able to see where the handover is waiting.

When separate services cannot share one transaction, use explicit durable state and recovery. A local outbox can record the intention to publish alongside the local change; consumers still need duplicate and reconciliation rules. The event-driven integration guide explains those boundaries without assuming that a broker guarantees every downstream business outcome.

Compensation also needs business meaning. Deleting an interpretation proposal might be safe, but cancelling an accepted dispatch instruction is a new authorised operation with its own consequences. Avoid describing all distributed recovery as “rollback” when some actions have already changed the real operating process.

Separate scaling needs without building a fragile call chain

AI workloads may require different concurrency controls from ordinary application requests. A queue can let inference workers scale without increasing pressure on the dispatch system. Bound the rate at which completed proposals enter review; otherwise faster inference can move the bottleneck into a human queue.

Measure the slowest useful path across services. If intake calls classification, which calls retrieval, which calls a model gateway, which calls validation, the final response includes every network and processing delay. Consider whether some boundaries can be local modules or asynchronous work. Independent deployment is not free latency.

Place retries deliberately. If every layer independently retries a failing dependency, one business request can generate many downstream attempts. Assign the retry owner, total deadline, attempt limit and backoff policy. Propagate cancellation where meaningful, and preserve durable work where it must survive the original caller.

Protect scarce model capacity and downstream application capacity separately. A model concurrency limit does not protect a dispatch API from a sudden backlog release. Test recovery after an outage, including the catch-up rate, rather than measuring only steady-state traffic.

Within a shared worker pool, decide whether one large customer or bulk submission may consume all capacity. Fair scheduling and bounded work units can matter more than adding another service boundary.

Make service identity and data access explicit

Each service boundary introduces a decision about authentication and authorisation. Establish which service is calling, which originating user or process it represents and which resource operation is allowed. A trusted internal network location should not imply access to every field report or application operation.

Keep credentials and privileged operations close to the capability that needs them. Interpretation workers may need source evidence but no dispatch-write credential. The adapter may submit approved instructions without needing unrestricted access to all model prompts. Use integration access control to define and test these narrower privileges.

Consider sensitive copies in queues, caches, logs and temporary object storage. Splitting a component can multiply those copies. Record retention, deletion and correction paths across them so that service independence does not create data that nobody knows how to remove or update.

Release components independently only when contracts support it

Version the proposal schema and its meaning. If the interpretation service changes a category definition, case-management rules and reporting may change even when the JSON still validates. Maintain consumer examples for important states and fields, including unknown values and missing optional evidence.

Test both contract compatibility and end-to-end outcomes. Contract tests can establish that an adapter accepts a payload, while business tests establish that the correct exception receives the correct instruction. Use integration testing to avoid mistaking successful service tests for a successful complete workflow.

For model, prompt and retrieval changes, retain release evidence through LLMOps. Pin the configuration used to create a proposal. A later operator should know whether a disputed category came from a new model, a changed prompt, a source update or a mapping defect in another service.

Design observability around a case that crosses boundaries

Carry a correlation reference from field-report receipt through interpretation, review and dispatch confirmation. Distinguish it from individual request and attempt identifiers. An operator should locate the case, understand its current owner and see the next action without opening every service console.

Define useful service-level objectives at the business boundary: time to a reviewable proposal, time from approval to confirmed dispatch and maximum unresolved-case age. Local availability metrics remain useful but cannot replace them. A healthy model worker and healthy adapter can coexist with a broken mapping between their records.

The monitoring guide develops the operational signals. Include runbooks for partial outages, backlog recovery, stale proposals and failed deployments. Test whether the duty team can identify the responsible component using permitted evidence rather than relying on the original architect's memory.

A practical decision record for the next boundary

For each proposed service, record its business capability, state owner, API or event contract, independent scaling need, release owner, failure response and operating cost. Compare that with keeping the capability as a module. The decision should state what becomes easier and which new recovery and security work becomes necessary.

Revisit the architecture pattern choice as workload and ownership change. A good initial modular design can support later extraction, while an unnecessary service split can be consolidated when its costs outweigh its value. Discuss AI service boundaries with the workload, current owners and one failure sequence that crosses the proposed services.

FAQ

Your questions, answered.

Should every AI pipeline step be a separate microservice?

No. Separate deployment should follow a concrete ownership, scaling, security or release need. Parsing, retrieval and validation can remain modules with clear interfaces inside one application. Turning every function into a service introduces network and operational complexity. Record the evidence that would justify extraction later rather than treating the number of services as a measure of architecture quality.

When should inference workers scale independently?

When their compute, concurrency or release requirements differ materially from the application and a queue can provide a clear work boundary. Protect downstream systems and review capacity separately. More inference workers do not automatically improve completed business throughput if the next step is rate-limited or awaits human review. Test backlog recovery as well as normal load.

Can AI microservices share one database?

A physical database arrangement is separate from ownership, but services should not rely on unrestricted writes to each other’s private tables. Define authoritative records and contracts. Shared tables can make independent release difficult and bypass validation. If the current scope is tightly coupled, a modular application may be more honest and manageable than nominally independent services sharing all state.

How do we handle a failure between AI case management and an ERP?

Persist the business state and intended handover, distinguish submitted from confirmed, and use the receiving application contract to reconcile unknown outcomes. Give the unresolved case an owner. Do not mark the workflow complete because the local service succeeded or assume that retrying creates no duplicate effect. Recovery must respect both applications and their separate transaction boundaries.

How should model changes be released in a microservices architecture?

Version the internal model, prompt and retrieval configuration and evaluate the proposal semantics against consumer expectations. A model change can alter category meaning or evidence quality without changing the JSON schema. Combine contract tests with end-to-end business cases and retain the configuration used for each result. Independent deployment requires compatibility evidence, not just a separate repository.

Which metrics matter across AI microservices?

Measure the complete business handover, including proposal readiness, approval-to-confirmation time, unresolved-case age and recovery after outages. Use local latency and availability to diagnose the cause, but do not substitute them for the outcome. Carry correlation references across services so operators can identify the current state, owner and next action for a specific case.

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.