Skip to content

Add a Redis Streams sample with resumable reads - #427

Draft
moetemp wants to merge 9 commits into
mainfrom
moe/streams-redis-sample
Draft

moetemp wants to merge 9 commits into
mainfrom
moe/streams-redis-sample

Conversation

@moetemp

@moetemp moetemp commented Nov 23, 2026 •

Copy link
Copy Markdown

This PR adds a Redis Streams sample with resumable agent events. The Activity writes fixed tokens, so no model service is required.

Update-with-Start makes the Stream ref available even if the Workflow finishes before the reader starts. Cancellation waits for the writer to stop before adding Done. A patch guard preserves recorded cancellation behavior. The client also observes the Workflow result because termination can prevent the final event.

Worker and Redis integration tests passed, along with offline replay, Ruff and focused mypy checks. The type checks used the reviewed SDK with the sample's baseline CI exclusion removed. Collection skips the sample when the unreleased packages are absent. An installed broken package fails collection.

Reviewer's guide

  1. Start with streams_redis/README.md. It covers unreleased builds, Redis requirements, offset resume and repeated tokens from Activity retries.
  2. Read agent_workflow.py, model_activity.py and run_agent.py. Check atomic ref acquisition, cancellation, terminal ordering and result observation.
  3. Read tests/streams_redis/agent_workflow_test.py. It checks late readers, running cancellation and termination. The saved History protects replay of the earlier cancellation behavior.

An agent's events in Redis outlive its Workflow, and a reader can leave
and resume at its offset. The test isn't collected and mypy skips the
sample until the two packages have a release, so CI stays green on the
released temporalio.
A Stream has no close in the current Streams API. The Workflow writes
the status event Done in finally, and each reader breaks at it.
@moetemp moetemp changed the title Add a sample of Streams on the Redis Stream Store Add a Redis Streams sample with resumable reads Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant