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 toclient.query(...) appends one turn of input; consume the reply to its end with client.receive_response():
Steering a response
Callclient.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
OnlyQoderSDKClient 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-uniquemessage_uuid, then call client.cancel_async_message(message_uuid) to cancel it before execution starts:
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 ofQoderSDKClient is owned by the caller. Two ways to manage it: