Highlights
- Streaming requests — real-time chunk delivery via async generators
- Notification subscriptions with overflow control
- Fluent builder API for ergonomic client construction
- Bundled native kernel — prebuilt
libstdio_bus.afor 4 platforms, zero external build steps - Native backend: event loop integration replaces background thread polling
- Binary resolution module for subprocess backend
Streaming API
async for event in bus.stream_request("pool_id", {"prompt": "..."}):
if event.type == StreamEventType.CHUNK:
print(event.data, end="", flush=True)
elif event.type == StreamEventType.RESULT:
final = event.dataChunks are delivered incrementally as they arrive — not accumulated and returned at the end.
Notification Subscriptions
sub = bus.subscribe("pool_id", overflow_policy=OverflowPolicy.DROP_OLDEST)
async for notification in sub:
process(notification)
bus.unsubscribe(sub)Builder API
bus = (
StdioBusBuilder()
.config(BusConfig(pools=[...]))
.backend("native")
.native_options(NativeOptions(listen_mode=ListenMode.TCP, tcp_port=9000))
.build_sync()
)Introspection
bus.get_worker_count() # int
bus.get_client_count() # int
bus.get_listen_mode() # ListenModeNative Backend: Event Loop Integration
All C API calls now execute exclusively on the owning asyncio event loop thread, matching the C library's single-thread contract.
- fd-driven mode (preferred): poll fd registered via
loop.add_reader()— zero-latency wake via kqueue/epoll - timer-driven mode (fallback):
loop.call_later()timer when poll fd unavailable - Thread affinity enforced:
send()from a foreign thread raisesTransportError - No background threads, no GIL contention, no race conditions
Native Kernel
Prebuilt static libraries in kernel/prebuilds/:
aarch64-apple-darwinx86_64-apple-darwinaarch64-unknown-linux-gnux86_64-unknown-linux-gnu
CLI binaries in kernel/dist/ for darwin-{amd64,arm64}, linux-{amd64,arm64,armv7}, linux-musl-{amd64,arm64}.
pip install stdiobus[native]Binary Resolution
Subprocess backend now resolves the stdio_bus binary with explicit precedence:
- User-provided path (override)
- Bundled
kernel/dist/stdio_buslauncher - System PATH fallback
Internal
- Renamed
_native→native(public module) - Added
setup.pywith conditional cffi extension build stream_echo_worker.pyfor E2E streaming validationtest_real_e2e.py— integration tests against live binarytest_native_threading.py— thread affinity invariant tests- 317+ unit/integration tests