A timeout excludes DNS or TLS setup
Detect: Observed wall-clock duration exceeds the configured request limit.
Recover: Verify client semantics and apply a true total deadline.
Allocate end-to-end deadlines across queueing, inference, tools, retries, and finalization so work stops predictably and uncertain side effects are reconciled.
Timeout policies bound how long a caller waits for an operation; deadlines express when the overall task must finish. Use both deliberately. A per-call timeout that resets at every layer can exceed the user's total budget, especially when retries, queueing, and nested agent calls accumulate.
Distinguish connection establishment, response headers, idle streaming, and total execution time. A timeout does not prove that the remote operation stopped or failed. For commands, the result may be unknown even after the caller gives up, so preserve operation identity and reconcile before retrying. Cancellation is cooperative unless the remote system offers stronger guarantees.
A prototype should set explicit model and tool timeouts and record actual latency distributions. Include slow connections and long silent streams in tests.
Production propagates a parent deadline, allocates remaining time to each stage, and reserves finalization capacity. Retry decisions must account for whether another attempt can finish usefully before the deadline.
At scale, tune by task class and dependency percentiles, including network and queue delay. Watch false timeouts and abandoned downstream work because overly aggressive limits can amplify load through retries.
Carries the task's remaining time through workers, tools, and delegated agents.
Divides available time among required work, retries, and finalization.
Applies connection, idle, and total-call limits supported by each client library.
Stops optional work and propagates cooperative cancellation when the task expires.
Determines whether timed-out commands actually committed before further action.
flowchart LR
D["Parent deadline"] --> Q["Queue wait"]
Q --> R["Remaining-time check"]
R --> M["Bounded model call"]
M --> T["Bounded tool call"]
T --> F["Reserved finalization"]
R --> X["Deadline exhausted"]
M --> X
T --> X
X --> C["Cancel and reconcile"]
C --> O["Explicit terminal status"]sequenceDiagram
participant A as Agent
participant T as Remote command service
participant R as Reconciler
A->>T: Command with stable operation key
T->>T: Commit effect
Note over A: Caller deadline expires
A->>R: Record uncertain outcome
R->>T: Query original operation key
T-->>R: Confirm committed result
R-->>A: Update durable operation statusDerive the allowed completion window from the user-facing service contract.
Include queue wait, prior stages, and delegation overhead in the remaining budget.
Choose a timeout no longer than the useful remaining task window after reserves.
Distinguish connection, idle, and total timeout reasons in telemetry.
Stop new work, cancel where supported, and classify commands as uncertain until reconciled.
Return complete, partial, deferred, or failed status with the known operation outcome.
Travel management · Illustrative enterprise scenario, not a reported customer outcome.
A corporate travel assistant checks availability and places a temporary reservation hold after user confirmation.
The booking service can accept a hold while its response is delayed beyond the client timeout.
The assistant must respect the interactive deadline without placing duplicate holds or falsely reporting failure.
A parent deadline covers search, confirmation, and hold creation; the command uses a stable operation key and reconciliation endpoint.
A confirmed existing hold is returned to the user; no new hold is created merely because the first response was late.
Track timeout reason, false-timeout rate, downstream work after cancellation, and time to reconcile uncertain holds.
| Decision | Benefit | Cost |
|---|---|---|
| Short timeouts | User waits and occupied resources are bounded. | Healthy slow requests may be abandoned and retried unnecessarily. |
| End-to-end deadlines | Nested work cannot silently exceed the service budget. | Some stages must skip optional work or return partial results. |
| Detailed timeout types | Operators can distinguish connection and processing problems. | Client libraries differ in what their settings actually cover. |
Detect: Observed wall-clock duration exceeds the configured request limit.
Recover: Verify client semantics and apply a true total deadline.
Detect: Total elapsed time exceeds the parent contract.
Recover: Recompute limits from remaining time before every attempt.
Reconcile commands using stable operation identity.
Charge time from accepted request to final delivery.
Tune against dependency behavior and user expectations.