Registry / ai-ml / assistant-stream

assistant-stream

JSON →
library0.0.32pypypi✓ verified 84d ago

assistant-stream is a Python library for building real-time streaming AI assistants with WebSocket connections. Current version is 0.0.32, pre-release, with daily updates. It provides a simple API for streaming text, tool calls, and events from language models directly to frontend interfaces.

pip install assistant-stream
INSTALL
IMPORT
SIG · ASSISTANT-STREAM
A
assistant-stream
ai-mlpythonv0.0.32
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AssistantStreamResponse
✓ from assistant_stream import AssistantStreamResponse
✗ from assistant_stream import AssistantStream
create_run
✓ from assistant_stream import create_run
RunController
✓ from assistant_stream import RunController

Basic asynchronous streaming assistant example using OpenAI.

import asyncio import os from assistant_stream import AssistantStream, create_stream async def main(): async def stream_handler(event): print(event) stream = create_stream( openai_api_key=os.environ.get('OPENAI_API_KEY', ''), model='gpt-3.5-turbo' ) assistant = AssistantStream(stream=stream, handler=stream_handler) await assistant.send_message("Hello!") asyncio.run(main())
Debug
Known issues
breakingIn version 0.0.30, the library moved from a synchronous to an asynchronous API. All functions now require asyncio context.
fix
Wrap code in async functions and use asyncio.run(). Change function calls to await.
affects: <0.0.30
breakingThe function 'create_stream' changed signature in 0.0.32: parameter 'api_key' renamed to 'openai_api_key', and 'model' parameter added as required.
fix
Use 'create_stream(openai_api_key=..., model=...)' instead of 'create_stream(api_key=...)'.
affects: >=0.0.32
gotchaAssistantStream requires a 'stream' object and a 'handler' async callable. Forgetting to provide both will raise TypeError at runtime.
fix
Always pass both 'stream' and 'handler' to AssistantStream constructor.
affects: >=0.0.30
deprecatedFunction 'create_assistant' is deprecated in favor of 'create_stream' since version 0.0.30.
fix
Replace 'create_assistant' with 'create_stream'.
affects: >=0.0.30
Upgrade
Version history
0.0.32latest on PyPI · released Apr 29, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
assistant-stream — pip install assistant-stream · libregistry