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

events-and-streaming changedmanaged-agents/events-and-streaming

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+8added
Lines−8removed
From line 327 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits31to this page, all time

The whole hunk

from line 327, old and new numbered
/
lines
from line 327
327327 
328328 // Tail live events, skipping anything already seen
329329 tail: for await (const event of stream) {
330 // Preview events (event_start/event_delta) carry no top-level id
330 // Preview events (event_start/event_delta) carry no top-level `id`
331331 if (event.type === "event_start" || event.type === "event_delta") {
332332 continue;
333333 }
from line 692
692692 for event in stream:
693693 match event.type:
694694 case "agent.custom_tool_use":
695 # Execute the tool
695 # Run the tool
696696 result = call_tool(event.name, event.input)
697697 
698698 # Send the result back
from line 717
717717 loop: for await (const event of stream) {
718718 switch (event.type) {
719719 case "agent.custom_tool_use": {
720 // Execute the tool
720 // Run the tool
721721 const result = await callTool(event.name, event.input);
722722 
723723 // Send the result back
from line 746
746746 {
747747 if (streamEvent.Value is BetaManagedAgentsAgentCustomToolUseEvent toolUse)
748748 {
749 // Execute the tool
749 // Run the tool
750750 var result = await CallTool(toolUse.Name, toolUse.Input);
751751 
752752 // Send the result back
from line 778
778778 for stream.Next() {
779779 switch event := stream.Current().AsAny().(type) {
780780 case anthropic.BetaManagedAgentsAgentCustomToolUseEvent:
781 // Execute the tool
781 // Run the tool
782782 result := callTool(event.Name, event.Input)
783783 // Send the result back
784784 if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{
from line 812
812812 for (var event : (Iterable<BetaManagedAgentsStreamSessionEvents>) stream.stream()::iterator) {
813813 switch (event.type().value()) {
814814 case AGENT_CUSTOM_TOOL_USE -> {
815 // Execute the tool
815 // Run the tool
816816 var toolUse = event.asAgentCustomToolUse();
817817 var result = callTool(toolUse.name(), toolUse.input());
818818 
from line 842
842842 foreach ($stream as $event) {
843843 switch (true) {
844844 case $event instanceof \Anthropic\Beta\Sessions\Events\ManagedAgentsAgentCustomToolUseEvent:
845 // Execute the tool
845 // Run the tool
846846 $result = callTool($event->name, $event->input);
847847 
848848 // Send the result back
from line 870
870870 client.beta.sessions.events.stream_events(session.id).each do |event|
871871 case event
872872 when Anthropic::Beta::Sessions::BetaManagedAgentsAgentCustomToolUseEvent
873 # Execute the tool
873 # Run the tool
874874 result = call_tool.call(event.name, event.input)
875875 # Send the result back
876876 client.beta.sessions.events.send_(
Feedback