Skip to main content
To send multiple user messages within the same session, use QoderSDKClient — it maintains a long-lived connection and lets you decide the next message based on the model’s reply. For one-shot, stateless queries, use query() (see Quick Start).

Multi-message session

Each call to client.query(...) appends one turn of input; consume the reply to its end with client.receive_response():

Interrupting the current turn

Only QoderSDKClient exposes runtime interruption; the one-shot query() iterator does not. Call await client.interrupt() while a response is active, then keep receiving messages until the turn reaches its terminal ResultMessage.
interrupt() does not disconnect the client, so it can accept another turn.

Managing the session lifecycle

The connection lifecycle of QoderSDKClient is owned by the caller. Two ways to manage it: Use this when the session’s lifetime is bound to a function or block scope:

Manual management

Use this when the client is held by a long-lived object, or when closure must be triggered by an external condition (timeout, user cancellation, etc.):