Python: adds valkey streaming support (python)- issue 5517#5543
Python: adds valkey streaming support (python)- issue 5517#5543MatthiasHowellYopp wants to merge 1 commit into
Conversation
4332de6 to
1bd9e18
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds first-party Valkey-based resumable streaming support to the Python Agent Framework via a new agent-framework-valkey package and accompanying samples/tests.
Changes:
- Introduces
ValkeyStreamBuffer(+StreamChunk) backed by Valkey Streams usingvalkey-glide - Adds unit + integration test suites for stream write/read, cursor resumption, timeouts, and callback-protocol behavior
- Registers the new package in the Python workspace and provides a runnable sample + docs
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/04-hosting/valkey_stream_buffer/valkey_stream_buffer.py | Adds a runnable sample demonstrating basic streaming, resumption, and error propagation. |
| python/samples/04-hosting/valkey_stream_buffer/README.md | Documents how to run the Valkey stream buffer sample. |
| python/pyproject.toml | Registers agent-framework-valkey in the workspace and adjusts tooling environments. |
| python/packages/valkey/agent_framework_valkey/_stream_buffer.py | Implements ValkeyStreamBuffer and stream parsing helpers. |
| python/packages/valkey/agent_framework_valkey/init.py | Exposes public package API (ValkeyStreamBuffer, StreamChunk, __version__). |
| python/packages/valkey/pyproject.toml | Defines the new package metadata, dependencies, and test/tooling config. |
| python/packages/valkey/README.md | Adds package-level documentation and quick start usage. |
| python/packages/valkey/LICENSE | Adds MIT license file for the new package. |
| python/packages/valkey/tests/test_stream_buffer.py | Adds unit tests with a mocked glide client covering read/write + callback semantics. |
| python/packages/valkey/tests/test_stream_buffer_integration.py | Adds opt-in integration tests against a real Valkey server. |
| .gitignore | Ignores .kiro/ directory. |
c54c5ba to
b2b8f9a
Compare
13bbbeb to
d588d73
Compare
e0d7d9e to
7d398f8
Compare
|
@moonbox3 Hoping I can get a review on this this week, tks |
7d398f8 to
1735d7e
Compare
1735d7e to
6deb317
Compare
|
@MatthiasHowellYopp I don't think this is the place for this package, it would mean we have to take ownership over this functionality, while it seems very tied to durable tasks and a service that we don't own, off course we have some others that we do ship with, but unless we have strong customer signal that this needs to be in our repo and metapackage we would prefer that this is hosted and released outside of ours, @sphenry can indicate if this is useful for us and if not how we could collaborate. |
Motivation and Context
The Agent Framework currently has no Valkey-native streaming component. The existing resumable streaming samples (python/samples/04-hosting/azure_functions/03_reliable_streaming/) use a RedisStreamResponseHandler built on redis-py — a sample-level implementation that isn't packaged for reuse and creates a dependency mismatch for Valkey users.
This PR delivers ValkeyStreamBuffer, a first-party, reusable streaming buffer backed by Valkey Streams using the valkey-glide client. It enables durable agents to persist response chunks so clients can disconnect and reconnect mid-stream without data loss.
Related issue: [Python] Add ValkeyStreamBuffer — resumable streaming via Valkey Streams for agent-framework-valkey #5517
Description
Adds the agent-framework-valkey Python package with a single component: ValkeyStreamBuffer.
###Core implementation (_stream_buffer.py):
Package scaffolding:
Tests (test_stream_buffer.py — 31 tests):
Files changed:
init.py (new)
_stream_buffer.py (new)
test_stream_buffer.py (new)
pyproject.toml (new)
python/packages/valkey/LICENSE (new)
README.md (new)
pyproject.toml (workspace registration)
Contribution Checklist