Production integration and recovery
A successful request validates connectivity. Production also requires business ownership, durable jobs, idempotent recovery, event handling, usage control and observability.
Persist the business job
Store your job ID and owner/customer, allowed service ID, request digest, idempotency key, Invocation/Goal ID, observed state version and accepted result. Keep access tokens, capability URLs and Secret values out of job rows.
Authorize the user, persist submission intent, call the platform, save its ID, then observe. Recover lost responses with the original key/input; recover process restarts by reading the recorded platform resource.
HTTP error policy
Native HTTP APIs use RFC 9457 Problem Details with code and request_id extensions. Make decisions from status/code, not by parsing human-readable detail.
| HTTP | Action |
|---|---|
| 400 | Correct fields, schema, cursor or parameters |
| 401 | Check credentials, expiry and audience; renew through the supported flow |
| 403 | Correct scope/project/resource authorization |
| 404 | Missing or invisible resource; do not infer cross-tenant existence |
| 409 | Reload versions or the original idempotent result |
| 429 | Respect Retry-After and distinguish rate, concurrency and usage limits |
| 5xx/network failure | Bounded GET retries; recover submissions with their original key/input |
Stopping observation and cancelling execution are different product actions. An HTTP timeout does not prove that work was not accepted.
Tenant and application quotas
Permissions, tenant quota, application quota, service concurrency and Runtime capacity intersect. Application registration does not grant unlimited inference. Administrators can bound admissions, active concurrency, tokens, cost and compute.
GET /api/v1/integration-clients/{id}/quota/status
GET /api/v1/usage/quota/status
GET /api/v1/application-metricsThese endpoints require their own authority. Do not issue management credentials to an end user just to show progress. Customer billing needs an explicit pricing contract rather than a guess from token counts.
Token and cache semantics
Invocation usage includes input/output tokens, cache reads/writes, reporting flags, model-cost microunits, compute milliseconds and elapsed time. cache_read_reported/cache_write_reported distinguish an authoritative zero from missing reporting.
REST int64 fields are decimal strings. Use safe decimal/BigInt handling and the configured currency/unit. Do not unconditionally add cache hits to input totals again or rebill parent aggregate usage as another execution.
Event handling and observability
Use SSE for current execution, JSON event pages for history and signed Webhooks for backend updates. Log business and platform correlation IDs plus bounded error codes. Keep raw Provider data, chain of thought, credentials and capability URLs out of ordinary logs.
Monitor duplicate processing, consumer failures and stream reconnection separately. Validate fields; do not inject arbitrary tool output as HTML or execute returned commands automatically.
Acceptance before launch
| Test | Required behavior |
|---|---|
| Duplicate submission | One idempotent logical execution |
| Accepted request, lost response | Recover with the original key |
| SSE/process restart | Reload snapshot and backfill business history |
| Duplicate/out-of-order Webhook | No duplicate business effects or state regression |
| Credential expiry/revocation | Explicit failure and closed unauthorized access |
| Approval/input wait | Supported interaction path, not an infinite loop |
| Quota exhaustion/Host loss | Accurate reason; queued is not running |
| Interrupted/invalid download | Fail and remove this incomplete transfer |
| Uncertain external effect | Reconcile before retrying |
Use an isolated project and test identity. Documentation contract tests do not replace qualification of your actual service, model route, domain tools and network.