Repository navigation
Conversation
Simulate a slow context load on cache misses, scale the default run to 4 workers x 20 workflows x 5 steps, and stream activity events to the parent for an optional live view and a side-by-side summary with an impact table (context loads, cache copies, latency). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each step now needs every earlier conversation turn. A worker fetches only the turns it is missing, with simulated latency per turn, so stale workers pay proportionally and the owner under affinity never fetches. The strip, live view, impact table, and verification report turns fetched instead of whole-context cache hits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use `workflow.activity_session(ActivitySessionOptions(placement=UseWorkflowSession()))` and `Worker(session_config=WorkerSessionConfig())`, matching the current sdk-python#1979 API.
Two single-session workers, each with its own stable identity, serve agent workflows that run every turn as an update inside an activity session scope. The run shows each agent binding to one worker, the bound worker taking no other workflow, and the binding surviving a worker crash and restart that reuses the stable identity, with the session's workspace intact.
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 was changed
activity_sessions: a worker pool compares activity affinity off vs on for workflows that reuse worker-local conversation history. Updated to the scope API:workflow.activity_session(ActivitySessionOptions(placement=UseWorkflowSession()))andWorker(session_config=WorkerSessionConfig()).single_session(new): two single-session workers (SingleSessionAdmission(stable_identity=...)) serve agent workflows whose turns run as updates inside an activity session scope. The run checks that each agent binds to one worker, the bound worker takes no other workflow, and the binding survives a worker crash and restart that reuses the stable identity.Why?
End-to-end demos of the Sessions API (activity affinity and single-session workers) for the AgentCore demo.
Checklist
TEMPORAL_TEST_ACTIVITY_SESSION_SAMPLE=1,TEMPORAL_TEST_SINGLE_SESSION_SAMPLE=1) pass against a server built from temporalio/temporalshivam/agentcore-single-session, using sdk-python#1979.