Repository navigation
Conversation
3 tasks
moetemp
force-pushed
the
moe/streams-api
branch
from
November 14, 2026 02:14
566c3ec to
fc6b8d3
Compare
This was referenced Nov 14, 2026
2 of 3 tasks
moetemp
force-pushed
the
moe/streams-api
branch
from
November 15, 2026 18:51
4c5003d to
09d01f5
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 15, 2026 20:23
09d01f5 to
acf7b46
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 16, 2026 17:14
acf7b46 to
5c6e8a8
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 16, 2026 17:33
5c6e8a8 to
d6d4073
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 16, 2026 19:42
d6d4073 to
d6dda76
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 18, 2026 02:13
9367bfa to
1b73059
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 22, 2026 01:10
f93c959 to
fab988c
Compare
moetemp
force-pushed
the
moe/streams-api
branch
2 times, most recently
from
November 22, 2026 03:31
4f48bab to
066b280
Compare
This was referenced Nov 22, 2026
Open
moetemp
force-pushed
the
moe/streams-api
branch
2 times, most recently
from
November 23, 2026 00:30
6656001 to
a4bdaa0
Compare
moetemp
force-pushed
the
moe/streams-api
branch
3 times, most recently
from
November 23, 2026 21:22
48539eb to
ce0ea46
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 23, 2026 21:41
ce0ea46 to
b1b2390
Compare
moetemp
force-pushed
the
moe/streams-api
branch
from
November 23, 2026 22:34
b1b2390 to
8dd0a9d
Compare
The Workflow path of Streams needs the Stream commands and jobs of this Core. The payload visitor reaches their payloads, so its generator gets the rule for a Stream body in this commit.
A Stream Store is the handler side of the Stream service, which the generated code doesn't have. The memory Store lets a test use Streams with no other service, behind the checks that Core runs for a Store of Workflow code.
The server has no Streams yet, so the last client interceptor sends each Stream call to a Store of the client's Stream config. The generated Stream code also needs its helpers, with the three that build a Producer.
Workflow code can't call a Store itself, since a replay must get the same answers. Core makes the append and the close inside the Workflow Task and records each result in a marker. A create and a describe have no command in Core, so they run in a Local Activity of the SDK.
A read of Workflow code is one command of Core with one job, as a Local Activity is, so no state of a read depends on where an activation ends. A replay reads the Records again from the Store, so a replay Worker gets the event loop that its Python Stores need.
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.
A `StreamRef[T]` lost its type as a dataclass field and a list item, and came back as its proto message under `T | None`. Only `StreamRef` takes the two new decoding paths, since a change for any other type would alter the replay of existing Workflow Histories.
A Stream read that waits past the heartbeat of its Workflow Task completes that task with no command, and with chunking a replay takes that task and the next one as one. Workflow code then gets two results in one activation that the first run gave in two, and can run in another order, as it can with Local Activities alone. Core records the choice in the first completed Workflow Task of a Workflow, so a Workflow that started before keeps chunking.
The generated Workflow `append` and `close` take no `producer`. The `StreamConfig` docs say which Producer a Workflow write has, in place of a note on an argument that is gone.
Plain client code has no target, so its selector couldn't pick a Store by namespace. Each path passes the namespace of its client or Worker, as external storage does for `StorageDriverSelectContext`.
moetemp
force-pushed
the
moe/streams-api
branch
from
November 23, 2026 23:22
8dd0a9d to
eaf832c
Compare
Core's Stream crate takes a ref in each request and the request id of a create or an append next to it, keeps the Stream calls of a Workflow Task on the task's completion, and gives an Activity task the id of its scheduled event. The bridge builds on it with the next commit.
The Stream API has a ref in each request and keeps the request id of a call out of it. A Store gets the request id as an argument, which client code makes for each call and Core makes for each append of Workflow code. The bridge turns a call that can't reach Python into an error, since Core doesn't catch a panic of a Store.
The generated Stream code converts a ref itself and sends no request id, so `_support` has no use for these four helpers.
A run can use an Activity id again, and the id of the scheduled event makes the two Activities separate Producers. Core reads it from the task token, and `activity.Info` keeps it in a private field next to the Workflow Task of a Local Activity.
Core gives each page the offset where the next read goes on, also a page with no Record, so Workflow code reads on from there as client code does.
A Store can leave the last_offset of a read page unset. Client and Activity code then get the offset of the last Record, or the from_offset of a page with no Record, as Workflow code does from Core.
The rules of each operation are now in the doc of its method. The test of a limit below one only repeated the check of the config, so it goes.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
This PR adds the hand-written part of the experimental Streams API. The public API is the code that nexgen generates in #2128, and this PR adds what that code calls.
A Stream is an ordered log of Records, such as the tokens of a model call.
StreamConfiggives a client its Stores, in the shape ofExternalStorage.StreamStoreis the interface of a Store, andMemoryStreamStoreis for tests. The Redis Store is in feat: implement the Stream Store trait on Redis temporal-community/sdk-streams#8.activity.Infofor a Local Activity #2127), so a Store that fences refuses an earlier attempt.StreamErrorgives the reason of a failed call, andtemporalio.contrib.streamshasBufferedAppenderand the Producer helpers.It needs Core's Stream PRs (temporalio/sdk-rust#1817, temporalio/sdk-rust#1801, temporalio/sdk-rust#1819 and temporalio/sdk-rust#1833), which have no release yet. The Workflow part is on an earlier revision of them, and it gets their current rules for a read with the next Core bump.
check-protosfails.scripts/gen_nexus_system_api.pydoesn't run nexgen on the Stream WIT yet, so the generated package of #2128 comes from a local run. The fix needs a nexgen release with temporalio/nexgen#437.Why?
An agent application shows partial output while the work still runs. That data doesn't belong in Workflow History, so a Stream keeps its Records in a Store outside it.
These points are open.
start_nexus_operationof the client interceptors, so a tracing interceptor sees a Nexus operation for each append.Reviewer's guide
About 4,000 of the ~7,100 added lines are tests.
client/_stream_store.py, forStreamStore(the contract of a Store) andStreamConfig.nexus/system/_support.py, the helpers that the generated code calls.worker/_workflow_streams.pyandbridge/src/streams.rs, for the Stream calls of Workflow code.converter/_payload_converter.py. AStreamRef[T]keeps its type as a dataclass field, so the JSON converter decodes by a type argument, only forStreamRef.contrib/streamsandtesting/_stream_store.py.How did you test it?
tests/nexus/test_streams.pycovers client and Activity code with seeded inputs against a model.tests/worker/test_workflow_streams.pyandtests/nexus/test_streams_with_worker.pyrun Workflows on the test server, with a replay.Link to a test plan if any -