01

The screen can close before the work finishes

A user uploads a long document, then watches a spinner for several minutes while an artificial intelligence (AI) assistant extracts the contents, checks references, and prepares a report. If the user closes the browser, it is unclear whether the job will finish or the document needs to be submitted again.

The execution mode determines how long users wait, how the system recovers from failures, and when a result becomes useful. Choose which work stays in the request and which gets a durable job according to the deadline for using that result.

02

Identify what the user needs immediately

Some tasks have value only while the user is present. An assistant helping a service agent compose the next reply needs a response within the conversation’s working rhythm. Define a response-time budget and decide what to show when the work exceeds it.

Limit retrieval and external calls on the immediate path, set explicit timeouts, and provide a useful fallback. Streaming can make generation feel responsive, but the application must still handle incomplete output and failures after the stream starts.

Some work can leave the immediate path. A service agent may need the reply draft now, while detailed classification or a summary runs later. Separating those steps can improve responsiveness while preserving the checks required before the reply is used.

Set a limit for the slowest acceptable response as well as measuring the average. A suggestion that arrives after the service agent has moved to the next customer has missed its purpose. Measure retrieval and tool calls separately to find which dependency uses the available time.

Users may read streamed prose as a finished recommendation while required checks are still pending. Decide what they can see before completion, label provisional output where necessary, and hold consequential actions until validation finishes. The interface and backend must agree on what counts as complete so the screen does not make unfinished work look ready.

03

Give longer work a durable job

Document analysis is a good candidate for background processing when the user can return to the result. Accept and validate the request, create a job identifier, and show a status page. Microsoft’s asynchronous request-reply pattern describes this separation between request acceptance, queued processing, and status retrieval. 1

Show whether a job is queued, running, completed, or failed. If progress cannot be measured, avoid a percentage based on elapsed time. A stage name such as extracting tables describes what the system is doing.

Decide how repeated submissions work. Users should be able to find an existing job, with protection against accidental duplicates where appropriate. Explain the limits of cancellation, since a request to stop may arrive after an external action has happened. Recheck authorization when a worker uses protected data and when a user retrieves the result.

A queued worker can disappear after storing part of a result. Retain enough job state to resume or safely repeat a stage, and publish the final artifact only after the required stages succeed. Keep the uploaded document associated with its job after the browser session ends.

Give users a stable place to return to completed work, see why a job failed, and retry its failed portion. Store the result before sending a completion notification. Delivery needs a separate recovery step so a failed notification does not rerun the analysis.

04

Group work that shares a deadline

Suppose a team reviews support themes every morning. Classifying the previous day’s tickets overnight can fit that decision well. A batch gives the team a defined input window and a consistent result to inspect.

Record which inputs were included, how late arrivals are handled, and when the batch becomes complete. Failed items need a retry path that preserves successful results. Publish completion and coverage together so a report cannot look finished while a substantial part of its input remains unprocessed.

Batch execution can improve scheduling flexibility, but savings depend on the provider, workload, and infrastructure. Compare measured costs and deadlines before assuming one execution mode will be cheaper.

For the morning support review, define the ticket cutoff and time zone, including whether overnight updates to older tickets count. Otherwise two runs with the same report date can cover different populations. Save the input selection so a reviewer can reproduce the coverage and explain it to the business.

Decide whether a partly completed batch is useful enough to release. A theme report covering half the queue can distort the apparent mix of issues, so it may need a coverage warning or a delayed release. Keep retried items associated with the original batch to calculate completeness accurately.

05

Account for time spent waiting

A fast model call can sit behind a long queue. Measure total time from submission to a usable result, including waiting, retrieval, processing, and delivery. Set limits on queue age and expire work whose result would arrive too late to matter.

Reserve capacity for short interactive jobs so long documents cannot occupy all their workers. Separate queues can also enforce that priority. Limit submissions from each user when their work could build a queue faster than the system can drain it.

Decide what happens when demand exceeds capacity. The system could explain why it is rejecting new work, offer a later deadline, or reduce optional processing. Background execution still leaves users waiting, even when they cannot see it. After uploading the document, they should have a job reference and a realistic completion expectation, with a return path to the report or a recoverable failure.

06

Define what cancellation actually stops

Closing a browser and canceling a durable job are different events. Decide whether work should continue after the user leaves, how the user finds it later, and when abandoned jobs expire. A cancel button should explain the state the worker can still reach. A task that has already sent a report cannot make the recipient unread it.

Check cancellation at a safe boundary before the next expensive step or external action. Preserve completed results when retention policy allows, and record whether the job stopped, finished before cancellation, or needs reconciliation. Test a cancel request racing with completion and a duplicate cancel request after a worker restart. The status endpoint should present a consistent outcome without implying that stopping computation reversed an earlier business action.

07

Set completion rules for partial results

Choose the completion state from the business task rather than the worker's exit code. In an illustrative document-processing job, nine completed files and one unreadable file may be a useful partial result, but they are not the complete ten-file request. Define whether the user can use the nine records, whether the missing file blocks a later action, and how that exception appears in the result. Keep the original request identifier and input set so that a retry handles the unresolved file without submitting the completed records again. Expose both processing progress and usable coverage; a percentage based only on worker tasks can hide an important missing input.

Apply the same reasoning to a batch window. State the business interval, expected input set, cutoff, and rule for late arrivals. A report marked complete should identify the coverage it actually includes. If a source arrives after the cutoff, decide whether to issue a new version, carry it into the next batch, or request a manual decision. Preserve the previous result when users may already have acted on it. A replacement with different totals needs a visible version and a reason, especially when an export has left the system. The batch owner should be able to explain which decisions need to be revisited.

Size a recovery exercise around a missed deadline. Pause processing long enough to create a backlog, then restore it while new work continues to arrive. Measure when the next useful result becomes available, including validation and delivery. Decide which work can wait and which needs reserved capacity; sharing one queue without a priority rule can let historical repairs delay current user requests. Test status retrieval during recovery as well as the processing workers. A user who cannot tell whether a durable job still exists may resubmit it. The final design should make the next safe action visible: wait, use a labeled partial result, supply a missing input, or escalate a job whose deadline has passed.

08

References

Microsoft Azure Architecture Center · Asynchronous request reply pattern

09

Related

Where to read next on the same subject.