Skip to main content
The agent’s runtime mode controls whether context may be returned. Correction activation and agent mode are separate: an active correction does not cause the SDK to return context while the agent is in shadow or off mode. Capture and mode refresh continue in all three server modes. Turning context delivery off does not stop trace capture. Disable locally with TypeScript’s setEnabled(false) or Python’s set_enabled(False). Both clients use dispose() to stop permanently. For the Python source package, start with the Python quickstart.

Start with shadow

Verify capture, review matches and exclusions, and measure the application’s baseline behavior. Then enable active delivery deliberately and increase traffic only when the observed results support it. The server’s emergency stop and traffic allocation remain authoritative.

Mode freshness and fallback

The SDK refreshes mode in the background, by default about once per second. An observation expires within three seconds. Before the first valid observation, or when an observation expires, retrieval returns empty immediately. This local fallback does not change the configured server mode. Remote changes become known through communication; a mode switch is not an instantaneous recall of previously returned context. Use returned text promptly, check expiry if dispatch is deferred, and retrieve again if the history changes.

Application cancellation

  • TypeScript: pass your existing AbortSignal to getContext, then preserve the application’s abort check before calling the model.
  • Python: pass a threading.Event as cancel to get_context. Check the event before calling the model. Async callers can use aget_context; task cancellation propagates as asyncio.CancelledError.
A canceled context request must not restart or retry a canceled model call. Reflect does not invoke the provider. See the Python SDK reference for synchronous and async cancellation details.