API & SDK

Prepare an integration for production

Apply security, cancellation, observability, and context controls before release.

Updated August 3, 2026 Β· 9 min

Separate environments

Use different agents or channels and independent credentials for development, testing, and production. Never test changes against real conversations.

Control request lifecycle

Set reasonable timeouts; propagate AbortSignal, iterator closure, or CancellationToken; keep conversation_id with the correct session; validate message size and origin.

Design retries

Honor Retry-After for 429 and use backoff only for transient, safely repeatable operations. Never automatically retry a started stream.

Observe without exposing data

Measure latency, HTTP status, cancellations, and usage. Correlate with technical IDs while excluding API keys, sensitive messages, and unnecessary content.

Before release, test regular and streamed responses, continuity, citations, errors, limits, cancellation, and credential rotation. Consult the current SDK documentation.