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

self-hosted-sandboxes-reference changedmanaged-agents/self-hosted-sandboxes-reference

Nearest release: v2.1.301, published 5 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+30added
Lines−34removed
From line 87 where the diff opens
First seen 2 Oct 2026 this site's first read of the page
Recorded edits5to this page, all time

The whole hunk

from line 87, old and new numbered
/
lines
from line 87
8787 
8888`EnvironmentWorker` manages the `AgentToolContext` and the toolset automatically. Pass a `tools` (go: `ToolsFunc`) factory to customize the tool list:
8989 
90<CodeGroup exclude="shell">
90<CodeGroup exclude="shell, csharp, java, php, ruby">
9191 ```python Python
9292 EnvironmentWorker(client, ..., tools=lambda env: [beta_bash_tool(env), my_custom_tool])
9393 ```
from line 101
101101 });
102102 ```
103103 
104 ```csharp C#
105 // EnvironmentWorker is not currently available in the C# SDK.
106 // To answer custom tool calls directly, see the session event stream.
107 ```
104 <CodeGroupItem language="C#">
105 The C# SDK does not have `EnvironmentWorker`. To answer custom tool calls from your own code, send each result on the session's event stream, as in [Return a custom tool result](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#return-a-custom-tool-result).
106 </CodeGroupItem>
108107 
109108 ```go Go
110109 worker := environments.NewEnvironmentWorker(client, environments.EnvironmentWorkerOptions{
from line 115
116115 })
117116 ```
118117 
119 ```java Java
120 // EnvironmentWorker is not currently available in the Java SDK.
121 // To answer custom tool calls directly, see the session event stream.
122 ```
118 <CodeGroupItem language="Java">
119 The Java SDK does not have `EnvironmentWorker`. To answer custom tool calls from your own code, send each result on the session's event stream, as in [Return a custom tool result](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#return-a-custom-tool-result).
120 </CodeGroupItem>
123121 
124 ```php PHP
125 // EnvironmentWorker is not currently available in the PHP SDK.
126 // To answer custom tool calls directly, see the session event stream.
127 ```
122 <CodeGroupItem language="PHP">
123 The PHP SDK does not have `EnvironmentWorker`. To answer custom tool calls from your own code, send each result on the session's event stream, as in [Return a custom tool result](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#return-a-custom-tool-result).
124 </CodeGroupItem>
128125 
129 ```ruby Ruby
130 # EnvironmentWorker is not currently available in the Ruby SDK.
131 # To answer custom tool calls directly, see the session event stream.
132 ```
126 <CodeGroupItem language="Ruby">
127 The Ruby SDK does not have `EnvironmentWorker`. To answer custom tool calls from your own code, send each result on the session's event stream, as in [Return a custom tool result](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#return-a-custom-tool-result).
128 </CodeGroupItem>
133129</CodeGroup>
134130 
135131### Work poller
from line 143
147143 
148144`client.beta.sessions.events.tool_runner()` (typescript: `client.beta.sessions.events.toolRunner()`; go: `client.Beta.Sessions.Events.NewToolRunner()`) takes a tool list as `tools` (go: `Tools`). To build that list, set up `AgentToolContext` yourself and call `beta_agent_toolset_20260401(env)` (typescript: `betaAgentToolset20260401(ctx)`; go: `agenttoolset.BetaAgentToolset20260401(env)`):
149145 
150<CodeGroup exclude="shell">
146<CodeGroup exclude="shell, csharp, java, php, ruby">
151147 ```python Python
152148 from anthropic.lib.tools.agent_toolset import (
153149 AgentToolContext,
from line 168
172168 const tools = betaAgentToolset20260401(ctx);
173169 ```
174170 
175 ```csharp C#
176 // AgentToolContext is not currently available in the C# SDK.
177 ```
171 <CodeGroupItem language="C#">
172 The C# SDK does not have `AgentToolContext`.
173 </CodeGroupItem>
178174 
179175 ```go Go
180176 env := &agenttoolset.AgentToolContext{Workdir: "/workspace"}
from line 181
185181 tools := agenttoolset.BetaAgentToolset20260401(env)
186182 ```
187183 
188 ```java Java
189 // AgentToolContext is not currently available in the Java SDK.
190 ```
184 <CodeGroupItem language="Java">
185 The Java SDK does not have `AgentToolContext`.
186 </CodeGroupItem>
191187 
192 ```php PHP
193 // AgentToolContext is not currently available in the PHP SDK.
194 ```
188 <CodeGroupItem language="PHP">
189 The PHP SDK does not have `AgentToolContext`.
190 </CodeGroupItem>
195191 
196 ```ruby Ruby
197 # AgentToolContext is not currently available in the Ruby SDK.
198 ```
192 <CodeGroupItem language="Ruby">
193 The Ruby SDK does not have `AgentToolContext`.
194 </CodeGroupItem>
199195</CodeGroup>
200196 
201197### AgentToolContext and the agent toolset
Feedback