Notification delivery fails
Detect: Operation is complete but callback attempts remain unsuccessful.
Recover: Retain the result for polling and retry notifications separately.
Move long-running agent work into durable jobs with explicit acceptance, progress, cancellation, and completion semantics.
Asynchronous execution separates accepting a request from completing its work. The service returns an operation identifier after durable acceptance, while workers process the operation independently of the user's connection. This is an API contract, not merely a background thread: clients need a reliable way to observe status and retrieve the final result.
The central difficulty is ownership across failures. A queue may deliver a job more than once, a worker can lose its lease, and a client can retry submission after an uncertain response. Use durable operation records, deduplication identities, and idempotent side effects to make these ordinary events safe.
A prototype can use an in-process task for disposable work. Confirm that losing the process and its work is acceptable before choosing that shortcut.
Production persists acceptance before acknowledgement, separates job state from queue state, and gives clients documented polling or notification behavior. Cancellation is cooperative unless the underlying operation supports stronger guarantees.
At enterprise scale, fair queues, tenant quotas, backpressure, and bounded worker concurrency protect interactive systems. Measure queue age independently from processing time because autoscaling cannot repair every downstream bottleneck.
Validates requests and creates durable operations with stable client-visible identifiers.
Buffers accepted work and supports retryable delivery without defining business truth.
Claims leased jobs and performs bounded tool and model operations.
Tracks progress, cancellation requests, final artifacts, and failure classifications.
Publishes completion events or authenticated callbacks without exposing internal job payloads.
sequenceDiagram
participant U as Analyst
participant A as Submission API
participant S as Operation store
participant Q as Job queue
participant W as Worker
U->>A: Request report with submission key
A->>S: Persist accepted operation
A-->>U: Operation identifier
A->>Q: Publish durable job
Q->>W: Deliver job
W->>S: Claim lease and checkpoint progress
W->>S: Commit result and terminal status
U->>A: Read operation status
A->>S: Read committed result
A-->>U: Report linkValidate the request and record its operation identity before returning acceptance.
Publish a job through an outbox or equivalent mechanism that closes the database-to-queue gap.
Acquire a renewable lease and verify that the operation remains eligible to run.
Save completed stages and progress so a replacement worker can resume safely.
Store the result reference and terminal status before sending a completion notification.
Let clients poll or reconnect using the operation identifier without creating another job.
Energy · Illustrative enterprise scenario, not a reported customer outcome.
A wind-farm operator requests maintenance summaries spanning inspection notes, sensor history, and spare-parts records.
The report takes longer than an interactive HTTP request and is frequently abandoned when a browser tab closes.
The assistant must accept the request promptly and produce a recoverable report with visible progress.
A submission service creates a durable operation, while leased workers retrieve evidence and assemble a versioned report artifact.
If a worker restarts, another worker resumes incomplete sections using the same operation identity and preserves finished artifacts.
Track queue age, completion latency, abandoned operations, duplicate submissions, and worker utilization rather than reporting only API response time.
| Decision | Benefit | Cost |
|---|---|---|
| Immediate acceptance | The interface remains responsive during expensive work. | Clients must understand eventual completion and error reporting. |
| Durable checkpoints | Worker replacement wastes less completed computation. | Persistence and schema evolution add operational cost. |
| Shared queues | Capacity can be pooled efficiently. | Fairness controls are necessary to prevent large tenants dominating service. |
Detect: Operation is complete but callback attempts remain unsuccessful.
Recover: Retain the result for polling and retry notifications separately.
Detect: Ownership version changes while the old worker is still active.
Recover: Fence writes and deduplicate side effects by operation identity.
Commit the operation before acknowledging it.
Document what can stop and reconcile completed side effects.
Keep an authoritative operation record.