Skip to content

feat: add Stream Stores - #2186

Open
moetemp wants to merge 4 commits into
moe/streams-generated-codefrom
moe/streams-stores
Open

moetemp wants to merge 4 commits into
moe/streams-generated-codefrom
moe/streams-stores

Conversation

@moetemp

@moetemp moetemp commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

The Stream Store layer of the Python SDK: the StreamStore contract, StreamConfig and StreamError, the test Store MemoryStreamStore, and BufferedAppender with current_producer and as_producer. It also sets UTC for the default times of ActivityEnvironment.

Why?

Every Stream call goes through a Store that the application registers in StreamConfig. None of this needs a Core change, so it can merge right after #2128.

Reviewer's guide

Review after #2128. Read the 4 commits in order.

  1. Use UTC for the default times of ActivityEnvironment. A one-line fix.
  2. Add the StreamStore contract, StreamConfig and StreamError.
  3. Add MemoryStreamStore.
  4. Add BufferedAppender, current_producer and as_producer.

Checklist

  • The commits are the first ones of the former #2129, unchanged.

`datetime.fromtimestamp(0)` reads the local time zone, so on a host west
of UTC the default times of `ActivityEnvironment` fall before 1970. SDK
Core and the client both refuse a Stream append whose Producer has an
attempt time before 1970.
A Store is the service that keeps the Records of a Stream. The contract
says what client, Activity and Workflow calls need from a Store, and
`StreamConfig` registers the Stores of a client and its Workers.
Tests and local runs need a Store with no other service. The memory
Store keeps its Streams in plain Python data and applies the rules of
`StreamStore` in their order, so it also shows what a Store does.
An Activity that appends each model token pays one Store call for each
token. The appender batches them with one write in flight, and stops at
the first failed batch so that a reader sees no gap. `current_producer`
and `as_producer` let resumed Activity work write as its first Producer.
@moetemp
moetemp added this pull request to stack #2189 December 2, 2026 22:49
@moetemp moetemp added the skip-changelog PR changes do not require changelog updates label Dec 2, 2026
@moetemp
moetemp marked this pull request as ready for review December 2, 2026 22:59
@moetemp
moetemp requested a review from a team as a code owner December 2, 2026 22:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR changes do not require changelog updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant