One read of Claude Developer Platformapi-20261104T220711Z
9 pages moved out of 847 read.
Pages moved
9
significant first
Pages read
847
in this capture
Captured
22:07 UTC
Corpus hash
67ab9c92f88d
corpus-hash
What this read moved
1-9 of 9agents-and-tools/agent-skills/quickstart Changed · +129 / -0 lines
from line 152
152152First, check what Skills are available. Use the Skills API to list all Anthropic-managed Skills. The example is an excerpt from one continuous script, with any imports and client setup at the top:
153153
154154<CodeGroup>
155 **CLI sign-in**
156
155157 ```bash cURL
156158 # List Anthropic-managed Skills
157159 curl --fail-with-body -sS "https://api.anthropic.com/v1/skills?source=anthropic" \
160 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
161 -H "anthropic-version: 2026-10-21"
162 ```
163
164 **API key**
165
166 ```bash cURL
167 # List Anthropic-managed Skills
168 curl --fail-with-body -sS "https://api.anthropic.com/v1/skills?source=anthropic" \
158169 -H "x-api-key: $ANTHROPIC_API_KEY" \
159170 -H "anthropic-version: 2026-10-21"
160171 ```
from line 257
246257Use the PowerPoint Skill to create a presentation about renewable energy. Specify Skills using the `container` parameter in the Messages API:
247258
248259<CodeGroup>
260 **CLI sign-in**
261
249262 ```bash cURL
250263 # Create a message with the PowerPoint Skill
251264 response=$(
252265 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
253266 -H "content-type: application/json" \
267 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
268 -H "anthropic-version: 2026-10-21" \
269 -d '{
270 "model": "claude-opus-5-5",
271 "max_tokens": 16000,
272 "container": {
273 "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
274 },
275 "messages": [
276 {"role": "user", "content": "Create a presentation about renewable energy with 5 slides"}
277 ],
278 "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]
279 }'
280 )
281 ```
282
283 **API key**
284
285 ```bash cURL
286 # Create a message with the PowerPoint Skill
287 response=$(
288 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
289 -H "content-type: application/json" \
254290 -H "x-api-key: $ANTHROPIC_API_KEY" \
255291 -H "anthropic-version: 2026-10-21" \
256292 -d '{
from line 515
479515The presentation was created in the code execution container and saved as a file. The Step 2 `response` includes a file reference with a file ID. Extract the file ID and download the file with the Files API. The example saves it to your system temp directory:
480516
481517<CodeGroup>
518 **CLI sign-in**
519
482520 ```bash cURL
483521 # Extract the file ID. The code execution tool runs the Skill's code through
484522 # its Bash sub-tool, and generated files appear as bash_code_execution_output
from line 534
496534 if [[ -n "$file_id" ]]; then
497535 # Download the file and save it
498536 curl --fail-with-body -sS "https://api.anthropic.com/v1/files/$file_id/content" \
537 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
538 -H "anthropic-version: 2026-10-21" \
539 -o "${TMPDIR:-/tmp}/renewable_energy.pptx"
540 fi
541 ```
542
543 **API key**
544
545 ```bash cURL
546 # Extract the file ID. The code execution tool runs the Skill's code through
547 # its Bash sub-tool, and generated files appear as bash_code_execution_output
548 # items inside the bash_code_execution_tool_result block.
549 file_id=$(jq -r '
550 last(
551 .content[]
552 | select(.type == "bash_code_execution_tool_result")
553 | .content
554 | select(.type == "bash_code_execution_result")
555 | .content[].file_id
556 ) // empty
557 ' <<<"$response")
558
559 if [[ -n "$file_id" ]]; then
560 # Download the file and save it
561 curl --fail-with-body -sS "https://api.anthropic.com/v1/files/$file_id/content" \
499562 -H "x-api-key: $ANTHROPIC_API_KEY" \
500563 -H "anthropic-version: 2026-10-21" \
501564 -o "${TMPDIR:-/tmp}/renewable_energy.pptx"
from line 783
720783### Create a spreadsheet
721784
722785<CodeGroup>
786 **CLI sign-in**
787
723788 ```bash cURL
724789 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
725790 -H "content-type: application/json" \
791 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
792 -H "anthropic-version: 2026-10-21" \
793 -d '{
794 "model": "claude-opus-5-5",
795 "max_tokens": 16000,
796 "container": {
797 "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]
798 },
799 "messages": [
800 {"role": "user", "content": "Create a quarterly sales tracking spreadsheet with sample data"}
801 ],
802 "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]
803 }'
804 ```
805
806 **API key**
807
808 ```bash cURL
809 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
810 -H "content-type: application/json" \
726811 -H "x-api-key: $ANTHROPIC_API_KEY" \
727812 -H "anthropic-version: 2026-10-21" \
728813 -d '{
from line 997
912997### Create a Word document
913998
914999<CodeGroup>
1000 **CLI sign-in**
1001
9151002 ```bash cURL
9161003 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
9171004 -H "content-type: application/json" \
1005 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
1006 -H "anthropic-version: 2026-10-21" \
1007 -d '{
1008 "model": "claude-opus-5-5",
1009 "max_tokens": 16000,
1010 "container": {
1011 "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]
1012 },
1013 "messages": [
1014 {"role": "user", "content": "Write a 2-page report on the benefits of renewable energy"}
1015 ],
1016 "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]
1017 }'
1018 ```
1019
1020 **API key**
1021
1022 ```bash cURL
1023 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
1024 -H "content-type: application/json" \
9181025 -H "x-api-key: $ANTHROPIC_API_KEY" \
9191026 -H "anthropic-version: 2026-10-21" \
9201027 -d '{
from line 1211
11041211### Generate a PDF
11051212
11061213<CodeGroup>
1214 **CLI sign-in**
1215
1216 ```bash cURL
1217 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
1218 -H "content-type: application/json" \
1219 -H "Authorization: Bearer $(ant auth print-credentials --access-token)" \
1220 -H "anthropic-version: 2026-10-21" \
1221 -d '{
1222 "model": "claude-opus-5-5",
1223 "max_tokens": 16000,
1224 "container": {
1225 "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]
1226 },
1227 "messages": [
1228 {"role": "user", "content": "Generate a PDF invoice template"}
1229 ],
1230 "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]
1231 }'
1232 ```
1233
1234 **API key**
1235
11071236 ```bash cURL
11081237 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
11091238 -H "content-type: application/json" \
managed-agents/event-deltas Changed · +2 / -4 lines
from line 408
408408 .build()
409409 );
410410
411 Iterable<BetaManagedAgentsStreamSessionEvents> events = stream.stream()::iterator;
412411 deltas:
413 for (var event : events) {
412 for (var event : stream) {
414413 switch (event.type().value()) {
415414 case EVENT_START -> {
416415 if (event.asEventStart().event().isAgentMessage()) {
from line 780
781780 .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE)
782781 .build()
783782 )) {
784 Iterable<BetaManagedAgentsStreamSessionThreadEvents> events = stream.stream()::iterator;
785783 threadDeltas:
786 for (var event : events) {
784 for (var event : stream) {
787785 switch (event.type().value()) {
788786 case EVENT_DELTA -> IO.print(event.asEventDelta().delta().content().text());
789787 case AGENT_MESSAGE -> {
managed-agents/events-and-streaming Changed · +2 / -3 lines
from line 214
214214 .build()
215215 );
216216
217 Iterable<BetaManagedAgentsStreamSessionEvents> events = stream.stream()::iterator;
218217 events:
219 for (var event : events) {
218 for (var event : stream) {
220219 switch (event.type().value()) {
221220 case AGENT_MESSAGE -> event.asAgentMessage().content().forEach(block -> block.text().ifPresent(textBlock -> IO.print(textBlock.text())));
222221 case SESSION_STATUS_IDLE -> {
from line 816
817816 ```java Java
818817 try (var stream = client.beta().sessions().events().streamStreaming(session.id())) {
819818 loop:
820 for (var event : (Iterable<BetaManagedAgentsStreamSessionEvents>) stream.stream()::iterator) {
819 for (var event : stream) {
821820 switch (event.type().value()) {
822821 case AGENT_CUSTOM_TOOL_USE -> {
823822 var toolUse = event.asAgentCustomToolUse();
managed-agents/quickstart Changed · +71 / -2 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() + "]");
agents-and-tools/tool-use/fine-grained-tool-streaming Changed · +1 / -3 lines
from line 772
772772 Map<Long, StringBuilder> toolInputs = new HashMap<>();
773773
774774 try (StreamResponse<RawMessageStreamEvent> streamResponse = client.messages().createStreaming(createParams)) {
775 var eventIterator = streamResponse.stream().iterator();
776 while (eventIterator.hasNext()) {
777 RawMessageStreamEvent event = eventIterator.next();
775 for (RawMessageStreamEvent event : streamResponse) {
778776 switch (event.type().value()) {
779777 case CONTENT_BLOCK_START -> {
780778 var blockStart = event.asContentBlockStart();
managed-agents/migration Changed · +1 / -2 lines
from line 990
990990 import com.anthropic.models.beta.environments.EnvironmentCreateParams;
991991 import com.anthropic.models.beta.sessions.BetaManagedAgentsAgentParams;
992992 import com.anthropic.models.beta.sessions.SessionCreateParams;
993 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents;
994993 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserCustomToolResultEventParams;
995994 import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams;
996995 import com.anthropic.models.beta.sessions.events.EventSendParams;
from line 1040
10411040 .build());
10421041
10431042 loop:
1044 for (var event : (Iterable<BetaManagedAgentsStreamSessionEvents>) stream.stream()::iterator) {
1043 for (var event : stream) {
10451044 switch (event.type().value()) {
10461045 case AGENT_MESSAGE -> {
10471046 for (var block : event.asAgentMessage().content()) {
managed-agents/session-threads Changed · +1 / -1 lines
from line 528
528528 .build()
529529 )) {
530530 loop:
531 for (var event : (Iterable<BetaManagedAgentsStreamSessionThreadEvents>) streamResponse.stream()::iterator) {
531 for (var event : streamResponse) {
532532 switch (event.type().value()) {
533533 case AGENT_MESSAGE -> {
534534 for (var block : event.asAgentMessage().content()) {
managed-agents/workflow-runs Changed · +1 / -2 lines
from line 559
559559 .build()
560560 );
561561
562 Iterable<BetaManagedAgentsStreamSessionEvents> events = stream.stream()::iterator;
563562 events:
564 for (var event : events) {
563 for (var event : stream) {
565564 switch (event.type().value()) {
566565 case WORKFLOW_RUN_CREATED -> {
567566 var created = event.asWorkflowRunCreated();
test-and-evaluate/strengthen-guardrails/handle-streaming-refusals Changed · +2 / -2 lines
from line 33
3333**API support**: Usage differs by product.
3434
3535* **Messages API**: The stream ends with `stop_reason` `"refusal"`, and `stop_details` (`category` and `explanation`) arrives on the `message_delta` event.
36* **Managed Agents**: A refused turn ends, and the session goes idle with `stop_reason.type` `"refusal"`.
36* **Managed Agents**: A refused turn ends, and the session goes idle. Treat a turn as refused if `stop_details.type` or `stop_reason.type` is `"refusal"`.
3737
3838Starting with Claude 4 models, streaming responses from Claude’s API return **`stop_reason`: `"refusal"`** when streaming classifiers intervene to handle potential policy violations. This safety feature helps maintain content compliance during real-time streaming.
3939
from line 388
388388#### [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview)
389389
390390* Availability: Always on
391* Usage: A refused turn ends, and the session goes idle with `stop_reason.type` `"refusal"` and `stop_details` (`category` and `explanation`) on the `session.status_idle` event.
391* Usage: A refused turn ends, and the session goes idle. Treat a turn as refused if `stop_details.type` or `stop_reason.type` on the `session.status_idle` event is `"refusal"`. On a refused turn, `stop_reason.type` can be `"end_turn"`. `stop_details` is `null` on any other turn, and can be `null` on a refused turn too.
392392
393393| Status | Cloud platforms |
394394| ------ | ------------------------------------------------------------------------------------------------------------------ |