Skip to Content
Huggler Docs

Control threads

Submit a turn, render live output, and resolve provider requests from your host.

Implementation by language

Choose how input is delivered

Launch a thread first, then send its first prompt as a separate command. A regular send starts a run on an idle thread. For busy threads, use the binding’s queue or steering support where available. For a Codex planning turn, select plan mode when sending.

Use a fresh command ID for each new action. Keep the original ID and payload to retry. The receipt reports acceptance. Read the associated run to see whether the provider completed, failed, or was interrupted.

Stream output and reconcile the final reply

Subscribe to the thread and render the returned snapshot. Group live output by run ID and replace provisional text with the committed assistant message when it arrives. Some providers supply only final text.

Keep consuming events while the run is active. A wait for terminal status may remain pending while the provider is waiting for user input. To stop the work, use the binding’s interruption command. Durability and recovery

Answer permissions and questions

  1. On startup, show pending permissions and questions from the snapshot.
  2. Listen for new requests. Present the provider’s options and preserve its request, thread, and owning run identifiers.
  3. Submit the option or answers chosen by the user. Use the provider’s option and question IDs.
  4. Remove the request when it closes. If the provider exits or a response races with closure, refresh the thread before continuing.

Attach text to a message

Where the binding supports uploads, stage a UTF-8 text file on the target thread and submit it with the message. Discard any staged file you decide to leave unused. Attach files in Python · Attach files in Rust

On this page