Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

event-deltas changedmanaged-agents/event-deltas

Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+12added
Lines−12removed
From line 117 where the diff opens
First seen 8 Oct 2026 this site's first read of the page
Recorded edits14to this page, all time

The whole hunk

from line 117, old and new numbered
/
lines
from line 117
117117 </CodeGroupItem>
118118 
119119 ```python Python
120 # Preview snapshots, keyed by event id. accumulate_managed_agents_event folds each
120 # Preview snapshots, keyed by event ID. accumulate_managed_agents_event folds each
121121 # event_start / event_delta into an agent.message snapshot; the buffered
122122 # agent.message replaces it.
123123 previews: dict[str, BetaManagedAgentsAgentMessageEvent] = {}
from line 171
171171 ```
172172 
173173 ```typescript TypeScript
174 // Preview snapshots, keyed by event id. `accumulateManagedAgentsEvent`
174 // Preview snapshots, keyed by event ID. `accumulateManagedAgentsEvent`
175175 // folds event_start / event_delta previews into an agent.message snapshot.
176176 const previews = new Map<string, BetaManagedAgentsAgentMessageEvent>();
177177 
from line 191
191191 deltas: for await (const event of stream) {
192192 switch (event.type) {
193193 case "event_start": {
194 // 1. Note the announced id and open the snapshot. Deltas and the
195 // buffered event carry the same id.
194 // 1. Note the announced ID and open the snapshot. Deltas and the
195 // buffered event carry the same ID.
196196 const preview = accumulateManagedAgentsEvent(undefined, event);
197197 if (preview) {
198198 previews.set(event.event.id, preview);
from line 256
256256 ],
257257 });
258258 
259 // Accumulate preview fragments per (event id, content index). The buffered
259 // Accumulate preview fragments for each (event ID, content index). The buffered
260260 // agent.message that follows carries the complete content, so it replaces the
261261 // accumulated preview rather than appending to it.
262262 Dictionary<string, SortedDictionary<long, string>> previews = [];
from line 265
265265 {
266266 if (streamEvent.TryPickStartEvent(out var start))
267267 {
268 // A preview opened for the event with this id. This stream only opts in
268 // A preview opened for the event with this ID. This stream only opts in
269269 // to agent.message deltas; TryPick* returns false instead of throwing,
270270 // so other preview types (including ones added later) are skipped.
271271 if (start.Event.TryPickAgentMessage(out var preview))
from line 331
331331 }
332332 
333333 // The accumulator folds event_start / event_delta fragments into
334 // per-event-id agent.message snapshots. The zero value is ready to use.
334 // agent.message snapshots, one for each event ID. The zero value is ready to use.
335335 var previews anthropic.BetaManagedAgentsEventAccumulator
336336 
337337 deltas:
from line 436
436436 use Anthropic\Beta\Sessions\Events\ManagedAgentsTextBlock;
437437 use Anthropic\Lib\Sessions\EventAccumulator;
438438 
439 // Preview snapshots, keyed by event id. EventAccumulator::accumulate() adds each
439 // Preview snapshots, keyed by event ID. EventAccumulator::accumulate() adds each
440440 // event_start / event_delta to an agent.message snapshot; the buffered
441441 // agent.message replaces it.
442442 $previews = [];
from line 523
523523 
524524 # Accumulate preview fragments by (event_id, index) into explicitly mutable
525525 # (`+""`) buffers so `<<` can append in place. The buffered agent.message with
526 # the same id is authoritative and replaces whatever the deltas built up.
526 # the same ID is authoritative and replaces whatever the deltas built up.
527527 buffers = Hash.new do |by_event, event_id|
528528 by_event[event_id] = Hash.new { |fragments, index| fragments[index] = +"" }
529529 end
from line 606
606606 case "event_delta":
607607 print(event.delta.content.text, end="")
608608 case "agent.message":
609 # The buffered event is the authoritative record; render its content
609 # The buffered event is the authoritative record; render its content.
610610 print()
611611 for block in event.content:
612612 if block.type == "text":
from line 708
708708 }
709709 
710710 // The child thread's stream takes the same event_deltas parameter as the
711 // session stream; run one read loop per stream connection.
711 // session stream; run one read loop for each stream connection.
712712 stream := client.Beta.Sessions.Threads.Events.StreamEvents(ctx, childThreadID, anthropic.BetaSessionThreadEventStreamParams{
713713 SessionID: session.ID,
714714 EventDeltas: []anthropic.BetaManagedAgentsDeltaType{
from line 806
806806 echo $event->delta->content->text;
807807 break;
808808 case $event instanceof ManagedAgentsAgentMessageEvent:
809 // The buffered event is the authoritative record; render its content
809 // The buffered event is the authoritative record; render its content.
810810 echo "\n";
811811 foreach ($event->content as $block) {
812812 if ($block instanceof ManagedAgentsTextBlock) {
Feedback