Follow Discord
Sweep 03 Nov 2026 · 22:27Z Build v2.1.318 536 read Stable v2.1.311 Latest v2.1.318 Next v2.1.318 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

quickstart changedmanaged-agents/quickstart

Recorded here
Lines+71added
Lines−2removed
From line 245 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits50to this page, all time

The whole hunk

from line 245, old and new numbered
/
lines
from line 245
245245 Create an agent that defines the model, system prompt, and available tools.
246246 
247247 <CodeGroup defaultLanguage="CLI">
248 **CLI sign-in**
249 
248250 <CodeGroupItem>
249251 ```bash cURL
250252 curl -sS --fail-with-body https://api.anthropic.com/v1/agents \
253 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
254 -H "anthropic-version: 2026-10-21" \
255 -H "anthropic-beta: managed-agents-2026-04-01" \
256 -H "content-type: application/json" \
257 -d '{
258 "name": "Coding Assistant",
259 "model": "claude-opus-5-5",
260 "system": "You are a helpful coding assistant. Write clean, well-documented code.",
261 "tools": [
262 {
263 "type": "agent_toolset_20260401",
264 "configs": [
265 {"name": "web_search", "enabled": false},
266 {"name": "web_fetch", "enabled": false}
267 ]
268 }
269 ]
270 }'
271 ```
272 
273 Save the returned `agent.id`. You’ll reference it in every session you create.
274 </CodeGroupItem>
275 
276 **API key**
277 
278 <CodeGroupItem>
279 ```bash cURL
280 curl -sS --fail-with-body https://api.anthropic.com/v1/agents \
251281 -H "x-api-key: $ANTHROPIC_API_KEY" \
252282 -H "anthropic-version: 2026-10-21" \
253283 -H "anthropic-beta: managed-agents-2026-04-01" \
from line 471
441471 import com.anthropic.models.beta.environments.BetaLimitedNetworkParams;
442472 import com.anthropic.models.beta.environments.EnvironmentCreateParams;
443473 import com.anthropic.models.beta.sessions.SessionCreateParams;
444 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents;
445474 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams;
446475 import com.anthropic.models.beta.sessions.events.EventSendParams;
447476 
from line 562
533562 An environment defines the sandbox where your agent runs. This one uses `limited` [networking](https://platform.claude.com/docs/en/managed-agents/environments#networking) with package managers allowed, so code running in the sandbox can reach public [package registries and code hosts](https://platform.claude.com/docs/en/managed-agents/environments#package-manager-hosts). With `limited` networking, the [`allowed_hosts` (java, php: `allowedHosts`; csharp, go: `AllowedHosts`) list](https://platform.claude.com/docs/en/managed-agents/environments#networking) also applies to web search and web fetch, even though they run outside the sandbox. With no hosts listed, as in this environment, they return no pages or search results. If your own agent uses these tools, add the hosts it needs to that list.
534563 
535564 <CodeGroup defaultLanguage="CLI">
565 **CLI sign-in**
566 
536567 <CodeGroupItem>
537568 ```bash cURL
538569 curl -sS --fail-with-body https://api.anthropic.com/v1/environments \
570 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
571 -H "anthropic-version: 2026-10-21" \
572 -H "anthropic-beta: managed-agents-2026-04-01" \
573 -H "content-type: application/json" \
574 -d '{
575 "name": "quickstart-env",
576 "config": {
577 "type": "cloud",
578 "networking": {"type": "limited", "allow_package_managers": true}
579 }
580 }'
581 ```
582 
583 Save the returned `environment.id` too.
584 </CodeGroupItem>
585 
586 **API key**
587 
588 <CodeGroupItem>
589 ```bash cURL
590 curl -sS --fail-with-body https://api.anthropic.com/v1/environments \
539591 -H "x-api-key: $ANTHROPIC_API_KEY" \
540592 -H "anthropic-version: 2026-10-21" \
541593 -H "anthropic-beta: managed-agents-2026-04-01" \
from line 761
709761 Create a session that references your agent and environment.
710762 
711763 <CodeGroup>
764 **CLI sign-in**
765 
712766 ```bash cURL
713767 curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \
768 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
769 -H "anthropic-version: 2026-10-21" \
770 -H "anthropic-beta: managed-agents-2026-04-01" \
771 -H "content-type: application/json" \
772 -d '{
773 "agent": "'"$AGENT_ID"'",
774 "environment_id": "'"$ENVIRONMENT_ID"'",
775 "title": "Quickstart session"
776 }'
777 ```
778 
779 **API key**
780 
781 ```bash cURL
782 curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \
714783 -H "x-api-key: $ANTHROPIC_API_KEY" \
715784 -H "anthropic-version: 2026-10-21" \
716785 -H "anthropic-beta: managed-agents-2026-04-01" \
from line 1055
9861055 
9871056 // Process streaming events
9881057 loop:
989 for (var event : (Iterable<BetaManagedAgentsStreamSessionEvents>) stream.stream()::iterator) {
1058 for (var event : stream) {
9901059 switch (event.type().value()) {
9911060 case AGENT_MESSAGE -> event.asAgentMessage().content().forEach(block -> block.text().ifPresent(textBlock -> IO.print(textBlock.text())));
9921061 case AGENT_TOOL_USE -> IO.println("\n[Using tool: " + event.asAgentToolUse().name() + "]");
Feedback