Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qoder.com/llms.txt

Use this file to discover all available pages before exploring further.

By default, a model’s reply is delivered as a single complete message at the end of each turn. With streaming output enabled, the SDK pushes fine-grained incremental chunks as the model generates them — useful for typewriter effects, or for rendering reasoning and tool-invocation progress separately.

Enable

Set include_partial_messages=True in QoderAgentOptions:
from qoder_agent_sdk import QoderAgentOptions, access_token_from_env, query

options = QoderAgentOptions(
    auth=access_token_from_env(),
    include_partial_messages=True,
)

async for msg in query(prompt="Write a short analysis report", options=options):
    ...

Typewriter effect

The model’s text reply arrives as a sequence of incremental chunks; printing each chunk as it lands gives a typewriter effect:
import sys

from qoder_agent_sdk import StreamEvent


async for msg in query(prompt="...", options=options):
    if isinstance(msg, StreamEvent):
        delta = msg.event.get("delta")
        if delta and delta.get("type") == "text_delta":
            sys.stdout.write(delta["text"])
            sys.stdout.flush()

Reasoning

Reasoning-capable models emit “thinking” chunks before their final reply:
if isinstance(msg, StreamEvent):
    delta = msg.event.get("delta")
    if delta and delta.get("type") == "thinking_delta":
        sys.stdout.write(delta["thinking"])
        sys.stdout.flush()

Tool invocation arguments

Tool-call arguments are also generated incrementally — for example, you can use this to render the file content the model is writing in real time in your UI:
if isinstance(msg, StreamEvent):
    delta = msg.event.get("delta")
    if delta and delta.get("type") == "input_json_delta":
        sys.stdout.write(delta["partial_json"])
        sys.stdout.flush()
For the full event structure, see SDK References.