quickstart changedmanaged-agents/quickstart
Nearest release: v2.1.283, published 3 hours after 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+349added
Lines−297removed
From line
136
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits12to this page, all time
The whole hunk
from line 136, old and new numbered
/
The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.
from line 136
136136 Create an agent that defines the model, system prompt, and available tools.
137137
138138 <CodeGroup defaultLanguage="CLI">
139 ```bash cURL
140 set -euo pipefail
141
142 agent=$(
143 curl -sS --fail-with-body https://api.anthropic.com/v1/agents \
144 -H "x-api-key: $ANTHROPIC_API_KEY" \
145 -H "anthropic-version: 2023-06-01" \
146 -H "anthropic-beta: managed-agents-2026-04-01" \
147 -H "content-type: application/json" \
148 -d @- <<'EOF'
149 {
150 "name": "Coding Assistant",
151 "model": "claude-opus-5-5",
152 "system": "You are a helpful coding assistant. Write clean, well-documented code.",
153 "tools": [
154 {"type": "agent_toolset_20260401"}
155 ]
156 }
157 EOF
158 )
159
160 AGENT_ID=$(jq -er '.id' <<<"$agent")
161 AGENT_VERSION=$(jq -er '.version' <<<"$agent")
162
163 echo "Agent ID: $AGENT_ID, version: $AGENT_VERSION"
164 ```
165
166 <MultiFileExample language="cli" label="CLI">
139 <CodeGroupItem>
140 ```bash cURL
141 set -euo pipefail
142
143 agent=$(
144 curl -sS --fail-with-body https://api.anthropic.com/v1/agents \
145 -H "x-api-key: $ANTHROPIC_API_KEY" \
146 -H "anthropic-version: 2023-06-01" \
147 -H "anthropic-beta: managed-agents-2026-04-01" \
148 -H "content-type: application/json" \
149 -d @- <<'EOF'
150 {
151 "name": "Coding Assistant",
152 "model": "claude-opus-5-5",
153 "system": "You are a helpful coding assistant. Write clean, well-documented code.",
154 "tools": [
155 {"type": "agent_toolset_20260401"}
156 ]
157 }
158 EOF
159 )
160
161 AGENT_ID=$(jq -er '.id' <<<"$agent")
162 AGENT_VERSION=$(jq -er '.version' <<<"$agent")
163
164 echo "Agent ID: $AGENT_ID, version: $AGENT_VERSION"
165 ```
166
167 Save the returned `agent.id`. You'll reference it in every session you create.
168 </CodeGroupItem>
169
170 <CodeGroupItem>
167171 ```bash CLI
168172 ant apply coding-assistant.md
169173 ```
from line 184
180184 You are a helpful coding assistant. Write clean, well-documented code.
181185 ```
182186 </File>
183 </MultiFileExample>
184
185 <ForLanguage tab="CLI">
187
186188 [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply) prints the agent's ID and records it in `claude-lock.json`. You'll reference it in every session you create.
187 </ForLanguage>
188
189 ```python Python
190 from anthropic import Anthropic
191
192 client = Anthropic()
193
194 agent = client.beta.agents.create(
195 name="Coding Assistant",
196 model="claude-opus-5-5",
197 system="You are a helpful coding assistant. Write clean, well-documented code.",
198 tools=[
199 {"type": "agent_toolset_20260401"},
189 </CodeGroupItem>
190
191 <CodeGroupItem>
192 ```python Python
193 from anthropic import Anthropic
194
195 client = Anthropic()
196
197 agent = client.beta.agents.create(
198 name="Coding Assistant",
199 model="claude-opus-5-5",
200 system="You are a helpful coding assistant. Write clean, well-documented code.",
201 tools=[
202 {"type": "agent_toolset_20260401"},
203 ],
204 )
205
206 print(f"Agent ID: {agent.id}, version: {agent.version}")
207 ```
208
209 Save the returned `agent.id`. You'll reference it in every session you create.
210 </CodeGroupItem>
211
212 <CodeGroupItem>
213 ```typescript TypeScript
214 import Anthropic from "@anthropic-ai/sdk";
215
216 const client = new Anthropic();
217
218 const agent = await client.beta.agents.create({
219 name: "Coding Assistant",
220 model: "claude-opus-5-5",
221 system: "You are a helpful coding assistant. Write clean, well-documented code.",
222 tools: [
223 { type: "agent_toolset_20260401" },
200224 ],
201 )
202
203 print(f"Agent ID: {agent.id}, version: {agent.version}")
204 ```
205
206 ```typescript TypeScript
207 import Anthropic from "@anthropic-ai/sdk";
208
209 const client = new Anthropic();
210
211 const agent = await client.beta.agents.create({
212 name: "Coding Assistant",
213 model: "claude-opus-5-5",
214 system: "You are a helpful coding assistant. Write clean, well-documented code.",
215 tools: [
216 { type: "agent_toolset_20260401" },
217 ],
218 });
219
220 console.log(`Agent ID: ${agent.id}, version: ${agent.version}`);
221 ```
222
223 ```csharp C#
224 using Anthropic;
225 using Anthropic.Models.Beta.Agents;
226 using Anthropic.Models.Beta.Environments;
227 using Anthropic.Models.Beta.Sessions;
228 using Anthropic.Models.Beta.Sessions.Events;
229
230 var client = new AnthropicClient();
231
232 var agent = await client.Beta.Agents.Create(new()
233 {
234 Name = "Coding Assistant",
235 Model = BetaManagedAgentsModel.ClaudeOpus5_5,
236 System = "You are a helpful coding assistant. Write clean, well-documented code.",
237 Tools =
238 [
239 new BetaManagedAgentsAgentToolset20260401Params
240 {
241 Type = "agent_toolset_20260401",
242 },
243 ],
244 });
245
246 Console.WriteLine($"Agent ID: {agent.ID}, version: {agent.Version}");
247 ```
248
249 ```go Go
250 package main
251
252 import (
253 "context"
254 "fmt"
255
256 "github.com/anthropics/anthropic-sdk-go"
257 )
258
259 func main() {
260 client := anthropic.NewClient()
261 ctx := context.Background()
262
263 agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{
264 Name: "Coding Assistant",
265 Model: anthropic.BetaManagedAgentsModelConfigParams{
266 ID: anthropic.BetaManagedAgentsModelClaudeOpus5_5,
267 },
268 System: anthropic.String("You are a helpful coding assistant. Write clean, well-documented code."),
269 Tools: []anthropic.BetaAgentNewParamsToolUnion{{
270 OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{
271 Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401,
272 },
273 }},
274 })
275 if err != nil {
276 panic(err)
277 }
278
279 fmt.Printf("Agent ID: %s, version: %d\n", agent.ID, agent.Version)
280 ```
281
282 ```java Java
283 import com.anthropic.client.okhttp.AnthropicOkHttpClient;
284 import com.anthropic.models.beta.agents.AgentCreateParams;
285 import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params;
286 import com.anthropic.models.beta.agents.BetaManagedAgentsModel;
287 import com.anthropic.models.beta.environments.BetaCloudConfigParams;
288 import com.anthropic.models.beta.environments.BetaUnrestrictedNetwork;
289 import com.anthropic.models.beta.environments.EnvironmentCreateParams;
290 import com.anthropic.models.beta.sessions.SessionCreateParams;
291 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents;
292 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams;
293 import com.anthropic.models.beta.sessions.events.EventSendParams;
294
295 void main() {
296 var client = AnthropicOkHttpClient.fromEnv();
297
298 var agent = client.beta().agents().create(AgentCreateParams.builder()
299 .name("Coding Assistant")
300 .model(BetaManagedAgentsModel.CLAUDE_OPUS_5_5)
301 .system("You are a helpful coding assistant. Write clean, well-documented code.")
302 .addTool(BetaManagedAgentsAgentToolset20260401Params.builder()
303 .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401)
304 .build())
305 .build());
306
307 IO.println("Agent ID: " + agent.id() + ", version: " + agent.version());
308 ```
309
310 ```php PHP
311 use Anthropic\Client;
312
313 $client = new Client();
314
315 $agent = $client->beta->agents->create(
316 name: 'Coding Assistant',
317 model: 'claude-opus-5-5',
318 system: 'You are a helpful coding assistant. Write clean, well-documented code.',
319 tools: [
320 ['type' => 'agent_toolset_20260401'],
321 ],
322 );
323
324 echo "Agent ID: {$agent->id}, version: {$agent->version}\n";
325 ```
326
327 ```ruby Ruby
328 require "anthropic"
329
330 client = Anthropic::Client.new
331
332 agent = client.beta.agents.create(
333 name: "Coding Assistant",
334 model: "claude-opus-5-5",
335 system_: "You are a helpful coding assistant. Write clean, well-documented code.",
336 tools: [{type: "agent_toolset_20260401"}]
337 )
338
339 puts "Agent ID: #{agent.id}, version: #{agent.version}"
340 ```
341
342 <ForLanguage not="CLI">
225 });
226
227 console.log(`Agent ID: ${agent.id}, version: ${agent.version}`);
228 ```
229
343230 Save the returned `agent.id`. You'll reference it in every session you create.
344 </ForLanguage>
231 </CodeGroupItem>
232
233 <CodeGroupItem>
234 ```csharp C#
235 using Anthropic;
236 using Anthropic.Models.Beta.Agents;
237 using Anthropic.Models.Beta.Environments;
238 using Anthropic.Models.Beta.Sessions;
239 using Anthropic.Models.Beta.Sessions.Events;
240
241 var client = new AnthropicClient();
242
243 var agent = await client.Beta.Agents.Create(new()
244 {
245 Name = "Coding Assistant",
246 Model = BetaManagedAgentsModel.ClaudeOpus5_5,
247 System = "You are a helpful coding assistant. Write clean, well-documented code.",
248 Tools =
249 [
250 new BetaManagedAgentsAgentToolset20260401Params
251 {
252 Type = "agent_toolset_20260401",
253 },
254 ],
255 });
256
257 Console.WriteLine($"Agent ID: {agent.ID}, version: {agent.Version}");
258 ```
259
260 Save the returned `agent.id`. You'll reference it in every session you create.
261 </CodeGroupItem>
262
263 <CodeGroupItem>
264 ```go Go
265 package main
266
267 import (
268 "context"
269 "fmt"
270
271 "github.com/anthropics/anthropic-sdk-go"
272 )
273
274 func main() {
275 client := anthropic.NewClient()
276 ctx := context.Background()
277
278 agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{
279 Name: "Coding Assistant",
280 Model: anthropic.BetaManagedAgentsModelConfigParams{
281 ID: anthropic.BetaManagedAgentsModelClaudeOpus5_5,
282 },
283 System: anthropic.String("You are a helpful coding assistant. Write clean, well-documented code."),
284 Tools: []anthropic.BetaAgentNewParamsToolUnion{{
285 OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{
286 Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401,
287 },
288 }},
289 })
290 if err != nil {
291 panic(err)
292 }
293
294 fmt.Printf("Agent ID: %s, version: %d\n", agent.ID, agent.Version)
295 ```
296
297 Save the returned `agent.id`. You'll reference it in every session you create.
298 </CodeGroupItem>
299
300 <CodeGroupItem>
301 ```java Java
302 import com.anthropic.client.okhttp.AnthropicOkHttpClient;
303 import com.anthropic.models.beta.agents.AgentCreateParams;
304 import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params;
305 import com.anthropic.models.beta.agents.BetaManagedAgentsModel;
306 import com.anthropic.models.beta.environments.BetaCloudConfigParams;
307 import com.anthropic.models.beta.environments.BetaUnrestrictedNetwork;
308 import com.anthropic.models.beta.environments.EnvironmentCreateParams;
309 import com.anthropic.models.beta.sessions.SessionCreateParams;
310 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents;
311 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams;
312 import com.anthropic.models.beta.sessions.events.EventSendParams;
313
314 void main() {
315 var client = AnthropicOkHttpClient.fromEnv();
316
317 var agent = client.beta().agents().create(AgentCreateParams.builder()
318 .name("Coding Assistant")
319 .model(BetaManagedAgentsModel.CLAUDE_OPUS_5_5)
320 .system("You are a helpful coding assistant. Write clean, well-documented code.")
321 .addTool(BetaManagedAgentsAgentToolset20260401Params.builder()
322 .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401)
323 .build())
324 .build());
325
326 IO.println("Agent ID: " + agent.id() + ", version: " + agent.version());
327 ```
328
329 Save the returned `agent.id`. You'll reference it in every session you create.
330 </CodeGroupItem>
331
332 <CodeGroupItem>
333 ```php PHP
334 use Anthropic\Client;
335
336 $client = new Client();
337
338 $agent = $client->beta->agents->create(
339 name: 'Coding Assistant',
340 model: 'claude-opus-5-5',
341 system: 'You are a helpful coding assistant. Write clean, well-documented code.',
342 tools: [
343 ['type' => 'agent_toolset_20260401'],
344 ],
345 );
346
347 echo "Agent ID: {$agent->id}, version: {$agent->version}\n";
348 ```
349
350 Save the returned `agent.id`. You'll reference it in every session you create.
351 </CodeGroupItem>
352
353 <CodeGroupItem>
354 ```ruby Ruby
355 require "anthropic"
356
357 client = Anthropic::Client.new
358
359 agent = client.beta.agents.create(
360 name: "Coding Assistant",
361 model: "claude-opus-5-5",
362 system_: "You are a helpful coding assistant. Write clean, well-documented code.",
363 tools: [{type: "agent_toolset_20260401"}]
364 )
365
366 puts "Agent ID: #{agent.id}, version: #{agent.version}"
367 ```
368
369 Save the returned `agent.id`. You'll reference it in every session you create.
370 </CodeGroupItem>
345371 </CodeGroup>
346372
347373 The `agent_toolset_20260401` tool type enables the full set of pre-built agent tools (bash, file operations, web search, and more). See [Tools](https://platform.claude.com/docs/en/managed-agents/tools) for the complete list and per-tool configuration options.
from line 377
351377 An environment defines the sandbox where your agent runs.
352378
353379 <CodeGroup defaultLanguage="CLI">
354 ```bash cURL
355 environment=$(
356 curl -sS --fail-with-body https://api.anthropic.com/v1/environments \
357 -H "x-api-key: $ANTHROPIC_API_KEY" \
358 -H "anthropic-version: 2023-06-01" \
359 -H "anthropic-beta: managed-agents-2026-04-01" \
360 -H "content-type: application/json" \
361 -d @- <<'EOF'
362 {
363 "name": "quickstart-env",
364 "config": {
365 "type": "cloud",
366 "networking": {"type": "unrestricted"}
380 <CodeGroupItem>
381 ```bash cURL
382 environment=$(
383 curl -sS --fail-with-body https://api.anthropic.com/v1/environments \
384 -H "x-api-key: $ANTHROPIC_API_KEY" \
385 -H "anthropic-version: 2023-06-01" \
386 -H "anthropic-beta: managed-agents-2026-04-01" \
387 -H "content-type: application/json" \
388 -d @- <<'EOF'
389 {
390 "name": "quickstart-env",
391 "config": {
392 "type": "cloud",
393 "networking": {"type": "unrestricted"}
394 }
367395 }
368 }
369 EOF
370 )
371
372 ENVIRONMENT_ID=$(jq -er '.id' <<<"$environment")
373
374 echo "Environment ID: $ENVIRONMENT_ID"
375 ```
376
377 <MultiFileExample language="cli" label="CLI">
396 EOF
397 )
398
399 ENVIRONMENT_ID=$(jq -er '.id' <<<"$environment")
400
401 echo "Environment ID: $ENVIRONMENT_ID"
402 ```
403
404 Save the returned `environment.id` too.
405 </CodeGroupItem>
406
407 <CodeGroupItem>
378408 ```bash CLI
379409 ant apply environment.yaml
380410 ```
from line 419
389419 type: unrestricted
390420 ```
391421 </File>
392 </MultiFileExample>
393
394 <ForLanguage tab="CLI">
422
395423 [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply) records the environment's ID in `claude-lock.json` too. To create the agent and the environment with one command, pass both files: `ant apply coding-assistant.md environment.yaml`.
396 </ForLanguage>
397
398 ```python Python
399 environment = client.beta.environments.create(
400 name="quickstart-env",
401 config={
402 "type": "cloud",
403 "networking": {"type": "unrestricted"},
424 </CodeGroupItem>
425
426 <CodeGroupItem>
427 ```python Python
428 environment = client.beta.environments.create(
429 name="quickstart-env",
430 config={
431 "type": "cloud",
432 "networking": {"type": "unrestricted"},
433 },
434 )
435
436 print(f"Environment ID: {environment.id}")
437 ```
438
439 Save the returned `environment.id` too.
440 </CodeGroupItem>
441
442 <CodeGroupItem>
443 ```typescript TypeScript
444 const environment = await client.beta.environments.create({
445 name: "quickstart-env",
446 config: {
447 type: "cloud",
448 networking: { type: "unrestricted" },
404449 },
405 )
406
407 print(f"Environment ID: {environment.id}")
408 ```
409
410 ```typescript TypeScript
411 const environment = await client.beta.environments.create({
412 name: "quickstart-env",
413 config: {
414 type: "cloud",
415 networking: { type: "unrestricted" },
416 },
417 });
418
419 console.log(`Environment ID: ${environment.id}`);
420 ```
421
422 ```csharp C#
423 var environment = await client.Beta.Environments.Create(new()
424 {
425 Name = "quickstart-env",
426 Config = new BetaCloudConfigParams { Networking = new BetaUnrestrictedNetwork() },
427 });
428
429 Console.WriteLine($"Environment ID: {environment.ID}");
430 ```
431
432 ```go Go
433 environment, err := client.Beta.Environments.New(ctx, anthropic.BetaEnvironmentNewParams{
434 Name: "quickstart-env",
435 Config: anthropic.BetaEnvironmentNewParamsConfigUnion{
436 OfCloud: &anthropic.BetaCloudConfigParams{
437 Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{
438 OfUnrestricted: &anthropic.BetaUnrestrictedNetworkParam{},
439 },
440 },
441 },
442 })
443 if err != nil {
444 panic(err)
445 }
446
447 fmt.Printf("Environment ID: %s\n", environment.ID)
448 ```
449
450 ```java Java
451 var environment = client.beta().environments().create(EnvironmentCreateParams.builder()
452 .name("quickstart-env")
453 .config(BetaCloudConfigParams.builder()
454 .networking(BetaUnrestrictedNetwork.builder().build())
455 .build())
456 .build());
457
458 IO.println("Environment ID: " + environment.id());
459 ```
460
461 ```php PHP
462 $environment = $client->beta->environments->create(
463 name: 'quickstart-env',
464 config: ['type' => 'cloud', 'networking' => ['type' => 'unrestricted']],
465 );
466
467 echo "Environment ID: {$environment->id}\n";
468 ```
469
470 ```ruby Ruby
471 environment = client.beta.environments.create(
472 name: "quickstart-env",
473 config: {type: "cloud", networking: {type: "unrestricted"}}
474 )
475
476 puts "Environment ID: #{environment.id}"
477 ```
478
479 <ForLanguage not="CLI">
450 });
451
452 console.log(`Environment ID: ${environment.id}`);
453 ```
454
480455 Save the returned `environment.id` too.
481 </ForLanguage>
456 </CodeGroupItem>
457
458 <CodeGroupItem>
459 ```csharp C#
460 var environment = await client.Beta.Environments.Create(new()
461 {
462 Name = "quickstart-env",
463 Config = new BetaCloudConfigParams { Networking = new BetaUnrestrictedNetwork() },
464 });
465
466 Console.WriteLine($"Environment ID: {environment.ID}");
467 ```
468
469 Save the returned `environment.id` too.
470 </CodeGroupItem>
471
472 <CodeGroupItem>
473 ```go Go
474 environment, err := client.Beta.Environments.New(ctx, anthropic.BetaEnvironmentNewParams{
475 Name: "quickstart-env",
476 Config: anthropic.BetaEnvironmentNewParamsConfigUnion{
477 OfCloud: &anthropic.BetaCloudConfigParams{
478 Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{
479 OfUnrestricted: &anthropic.BetaUnrestrictedNetworkParam{},
480 },
481 },
482 },
483 })
484 if err != nil {
485 panic(err)
486 }
487
488 fmt.Printf("Environment ID: %s\n", environment.ID)
489 ```
490
491 Save the returned `environment.id` too.
492 </CodeGroupItem>
493
494 <CodeGroupItem>
495 ```java Java
496 var environment = client.beta().environments().create(EnvironmentCreateParams.builder()
497 .name("quickstart-env")
498 .config(BetaCloudConfigParams.builder()
499 .networking(BetaUnrestrictedNetwork.builder().build())
500 .build())
501 .build());
502
503 IO.println("Environment ID: " + environment.id());
504 ```
505
506 Save the returned `environment.id` too.
507 </CodeGroupItem>
508
509 <CodeGroupItem>
510 ```php PHP
511 $environment = $client->beta->environments->create(
512 name: 'quickstart-env',
513 config: ['type' => 'cloud', 'networking' => ['type' => 'unrestricted']],
514 );
515
516 echo "Environment ID: {$environment->id}\n";
517 ```
518
519 Save the returned `environment.id` too.
520 </CodeGroupItem>
521
522 <CodeGroupItem>
523 ```ruby Ruby
524 environment = client.beta.environments.create(
525 name: "quickstart-env",
526 config: {type: "cloud", networking: {type: "unrestricted"}}
527 )
528
529 puts "Environment ID: #{environment.id}"
530 ```
531
532 Save the returned `environment.id` too.
533 </CodeGroupItem>
482534 </CodeGroup>
483535
484536 <Tip>
485537
No line in this hunk matches that.