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():

Steering a response

Call client.query(...) again while the current response is being consumed to send another message over the same long-lived session:
priority controls when a message is delivered: Messages with the same priority run in send order. Use priority="now" to change direction immediately. To stop the current response without sending another message, use client.interrupt().

Add context without starting a response

should_query=False adds the message to the conversation without starting a response by itself. Its processing time still follows priority.

Interrupting the current response

Only QoderSDKClient exposes runtime interruption; the one-shot query() iterator does not. Call await client.interrupt() to stop the current response without disconnecting the client. You can continue the conversation afterward.
interrupt() does not clear later queued messages or disconnect the client, so it can accept another turn.

Cancel a queued message

Give each tracked message a session-unique message_uuid, then call client.cancel_async_message(message_uuid) to cancel it before execution starts:
The method returns True when the message is cancelled and False when the message is not found or can no longer be cancelled. Messages without a UUID cannot be cancelled this way. Do not reuse UUIDs within a session.

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.):