Skip to content
Prompty

Streaming

Streaming is enabled through provider options and runtime-specific stream APIs. Callers usually request a raw streaming provider response, then pass it through process to get clean chunks.

agent = prompty.load("chat.prompty")
messages = prompty.prepare(agent, inputs={"q": "Hi"})
agent.model.options.additionalProperties = {"stream": True}
response = prompty.run(agent, messages, raw=True)
for chunk in prompty.process(agent, response):
print(chunk, end="", flush=True)
Type Description
PromptyStream Sync stream wrapper with tracing support
AsyncPromptyStream Async stream wrapper with tracing support
StreamChunk Schema-level chunk union for text, thinking, tool, and error chunks

For schema details, see StreamChunk and StreamOptions.